/* Import Export Trade of Pakistan — styles */
:root {
  color-scheme: light;
  --brand: #0b6b3a;
  --topbar: #0b6b3a;
  --brand-strong: #075030;
  --brand-soft: #e3f1e8;
  --on-brand: #ffffff;
  --page: #f6f6f3;
  --surface-1: #fcfcfb;
  --surface-2: #f0efec;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #6f6d68;
  --axis: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 16px rgba(0, 0, 0, .04);
  --series-1: #2a78d6;   /* exports (blue) */
  --series-2: #eb6834;   /* imports (orange) */
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #6250d6;
  --series-8: #e34948;
  --prior: #c3c2b7;      /* last-year comparison bars */
  --pos: #2a78d6;
  --neg: #e34948;
  --good-text: #006300;
  --bad-text: #b42318;
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --font-ur: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Noto Naskh Arabic", "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --hdr: 94px;        /* title bar + ticker */
  --gold: #f6c445;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --brand: #2fa866; --topbar: #0f4a2c; --brand-strong: #6fd39b; --brand-soft: #16301f; --on-brand: #04130a;
    --page: #0d0d0d; --surface-1: #1a1a19; --surface-2: #242422;
    --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #a3a197; --axis: #898781;
    --grid: #2c2c2a; --baseline: #383835; --border: rgba(255, 255, 255, 0.10);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
    --prior: #5a5955; --pos: #3987e5; --neg: #e66767; --good-text: #3ccf3c; --bad-text: #ff8a80;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --brand: #2fa866; --topbar: #0f4a2c; --brand-strong: #6fd39b; --brand-soft: #16301f; --on-brand: #04130a;
  --page: #0d0d0d; --surface-1: #1a1a19; --surface-2: #242422;
  --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #a3a197; --axis: #898781;
  --grid: #2c2c2a; --baseline: #383835; --border: rgba(255, 255, 255, 0.10);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  --prior: #5a5955; --pos: #3987e5; --neg: #e66767; --good-text: #3ccf3c; --bad-text: #ff8a80;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font); background: var(--page); color: var(--text-primary);
  font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
a { color: var(--brand); }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .4em; }
.muted { color: var(--text-muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Login ---------- */
.login {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
  background: radial-gradient(1200px 600px at 10% -10%, var(--brand-soft), transparent 60%), var(--page);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 20px; padding: 28px 24px; box-shadow: var(--shadow);
}
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login-logo img { width: 52px; height: 52px; border-radius: 14px; }
.login-logo h1 { font-size: 20px; margin: 0; }
.login-logo p { margin: 0; color: var(--text-secondary); font-size: 13px; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--baseline);
  background: var(--surface-1); color: var(--text-primary); font-size: 16px;
}
.field input:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
.pw-wrap { position: relative; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent;
  padding: 8px 10px; cursor: pointer; color: var(--text-secondary); font-size: 13px; font-weight: 600;
}
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-secondary); margin: 4px 0 16px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  background: var(--brand); color: var(--on-brand); padding: 12px 18px; border-radius: 12px; font-weight: 600;
}
.btn:hover { filter: brightness(1.05); }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--text-primary); border: 1px solid var(--border); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.error { color: var(--bad-text); font-size: 14px; min-height: 20px; margin: 4px 0 8px; }
.login-foot { margin-top: 16px; font-size: 12px; color: var(--text-muted); text-align: center; }

/* ---------- App shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; color: #fff;
  background: linear-gradient(100deg, #075030 0%, var(--topbar) 35%, #0f8a4c 70%, #075030 100%);
  box-shadow: 0 2px 14px rgba(0, 0, 0, .18);
}
.topbar-row { display: flex; align-items: center; gap: 10px; padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top)); min-height: 58px; }
.topbar .brand { min-width: 0; }
.topbar .sub-ur { font-family: var(--font-ur); }
.top-bot {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid rgba(255, 255, 255, .35); cursor: pointer;
  background: rgba(255, 255, 255, .12); color: #fff; border-radius: 999px; padding: 7px 14px 7px 10px; font-weight: 700; font-size: 13.5px;
}
.top-bot svg { width: 20px; height: 20px; }
.top-bot:hover { background: rgba(255, 255, 255, .22); }
/* running ticker */
.ticker {
  position: relative; overflow: hidden; height: 34px; display: flex; align-items: center;
  background: rgba(0, 0, 0, .22); border-top: 1px solid rgba(246, 196, 69, .55);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
}
.ticker-track { display: flex; width: max-content; animation: tk-run 75s linear infinite; }
.ticker:hover .ticker-track, .ticker:focus-within .ticker-track { animation-play-state: paused; }
.tk-move { display: flex; align-items: center; flex-shrink: 0; }
.tk-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 13px; color: #fff; }
.tk-item b { font-weight: 650; color: #fff6d8; }
.tk-item img { width: 22px; height: 22px; border-radius: 6px; background: #fff; }
.tk-up { color: #9ff0c2; font-weight: 700; }
.tk-down { color: #ffc0b3; font-weight: 700; }
.tk-note { font-size: 11.5px; opacity: .75; }
.tk-sep { color: var(--gold); margin: 0 18px; font-size: 9px; opacity: .9; }
@keyframes tk-run { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .ticker { overflow-x: auto; -webkit-mask-image: none; mask-image: none; }
  .ticker-track { animation: none; }
  .tk-move + .tk-move { display: none; }
}
.topbar img { width: 32px; height: 32px; border-radius: 9px; background: #fff; }
.topbar .title { font-weight: 700; font-size: 16px; line-height: 1.1; }
.topbar .sub { font-size: 11.5px; opacity: .85; }
.topbar .spacer { flex: 1; }
.icon-btn {
  border: 0; background: rgba(255, 255, 255, .14); color: #fff; width: 38px; height: 38px; border-radius: 10px;
  display: inline-grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { background: rgba(255, 255, 255, .24); }
.icon-btn svg { width: 20px; height: 20px; }
.menu-btn { display: none; }
.install-btn { border: 0; background: #fff; color: var(--brand-strong); border-radius: 10px; padding: 8px 12px; font-weight: 700; cursor: pointer; font-size: 13px; }
:root[data-theme="dark"] .install-btn { color: #075030; }

.shell { display: flex; min-height: calc(100vh - var(--hdr)); transition: padding-right .25s ease; }
.sidenav {
  width: 232px; flex-shrink: 0; padding: 14px 10px; border-right: 1px solid var(--border); background: var(--surface-1);
  position: sticky; top: var(--hdr); height: calc(100vh - var(--hdr)); overflow-y: auto;
}
.nav-bot .nav-lock { margin-left: auto; font-size: 12px; opacity: .75; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; border-radius: 10px;
  border: 0; background: transparent; cursor: pointer; color: var(--text-secondary); font-weight: 600; font-size: 14.5px;
  text-decoration: none;
}
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-item:hover { background: var(--surface-2); color: var(--text-primary); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-strong); }
.nav-sep { height: 1px; background: var(--border); margin: 10px 6px; }
main { flex: 1; min-width: 0; padding: 20px 22px 40px; max-width: 1240px; }
.bottomnav { display: none; }
.scrim { display: none; }

@media (max-width: 900px) {
  .sidenav {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100%; z-index: 60; transform: translateX(-105%);
    transition: transform .22s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .25); padding-top: max(18px, env(safe-area-inset-top));
    width: 270px;
  }
  .sidenav.open { transform: translateX(0); }
  .scrim.open { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 50; }
  main { padding: 14px 12px calc(86px + env(safe-area-inset-bottom)); }
  .bottomnav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--surface-1); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom);
  }
  .bottomnav button {
    border: 0; background: transparent; padding: 8px 2px 7px; display: grid; justify-items: center; gap: 2px;
    color: var(--text-muted); font-size: 11px; font-weight: 600; cursor: pointer;
  }
  .bottomnav button svg { width: 22px; height: 22px; }
  .bottomnav button.active { color: var(--brand); }
  .hide-mobile { display: none !important; }
  .menu-btn { display: inline-grid; }
  .topbar .sub-ur { display: none; }
  .top-bot span { display: none; }
  .top-bot { padding: 8px; }
}
@media (max-width: 600px) {
  .top-bot { display: none; }
  .topbar .title { font-size: 14.5px; }
  .topbar .sub { font-size: 11px; }
}

/* ---------- Page content ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; }
.page-head h2 { font-size: 22px; margin: 0; }
.page-head p { margin: 2px 0 0; color: var(--text-secondary); font-size: 14px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text-secondary); font-size: 12px; font-weight: 600; }
.grid { display: grid; gap: 14px; }
.grid.kpi { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
@media (max-width: 420px) { .grid.two { grid-template-columns: 1fr; } .grid.kpi { grid-template-columns: 1fr 1fr; } }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 700; margin: 22px 0 10px; }

.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card h3 { font-size: 15.5px; margin: 0 0 2px; }
.card .card-sub { font-size: 12.5px; color: var(--text-muted); margin: 0 0 12px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-actions { display: flex; gap: 6px; flex-shrink: 0; }
.link-btn { border: 1px solid var(--border); background: transparent; color: var(--text-secondary); border-radius: 8px; padding: 4px 9px; font-size: 12px; cursor: pointer; font-weight: 600; }
.link-btn:hover { background: var(--surface-2); color: var(--text-primary); }
.card-foot { font-size: 12px; color: var(--text-muted); margin-top: 10px; }

/* stat tile */
.stat .label { font-size: 13px; color: var(--text-secondary); font-weight: 600; }
.stat .value { font-size: 28px; font-weight: 650; margin: 2px 0; letter-spacing: -.01em; }
.stat .delta { font-size: 13px; font-weight: 600; }
.stat .delta.up-good, .stat .delta.down-good { color: var(--good-text); }
.stat .delta.up-bad, .stat .delta.down-bad { color: var(--bad-text); }
.stat .ctx { font-size: 12px; color: var(--text-muted); }
.stat .key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }

/* charts */
.chart { width: 100%; position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--text-secondary); margin: 0 0 8px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend i.line { height: 3px; border-radius: 2px; vertical-align: 3px; width: 16px; }
.viz-tip {
  position: fixed; z-index: 200; pointer-events: none; background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border); box-shadow: 0 6px 24px rgba(0, 0, 0, .16); border-radius: 10px; padding: 8px 10px;
  font-size: 12.5px; max-width: 260px; opacity: 0; transition: opacity .1s;
}
.viz-tip.show { opacity: 1; }
.viz-tip b { font-weight: 650; }
.viz-tip .row { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.viz-tip .sw { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-right: 4px; }
.segbar { display: flex; gap: 2px; height: 28px; margin: 6px 0 10px; }
.segbar div { border-radius: 4px; display: flex; align-items: center; padding-left: 8px; color: #fff; font-size: 12px; font-weight: 650; overflow: hidden; white-space: nowrap; cursor: default; min-width: 2px; }
.segbar div.dark-text { color: #0b0b0b; }

/* tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { padding: 8px 10px; border-bottom: 1px solid var(--grid); text-align: left; vertical-align: top; }
table.data th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 700; white-space: nowrap; }
table.data td.n, table.data th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
.chg-up { color: var(--good-text); font-weight: 600; }
.chg-down { color: var(--bad-text); font-weight: 600; }
.chg-neutral { color: var(--text-secondary); font-weight: 600; }

/* insight list */
.insights { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.insights li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.insights li .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); margin-top: 7px; flex-shrink: 0; }

/* status badges (icon + label, never color alone) */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-primary); white-space: nowrap; }
.badge .sdot { width: 8px; height: 8px; border-radius: 50%; }
.route-card { display: grid; gap: 6px; }
.route-card .rhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.route-card h4 { margin: 0; font-size: 15px; }
.route-card .where { font-size: 12.5px; color: var(--text-muted); }
.route-card p { margin: 0; font-size: 13.5px; color: var(--text-secondary); }

/* checks */
.check-row { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--grid); }
.check-row:last-child { border-bottom: 0; }
.check-ico { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; }
.check-ico.ok { background: var(--status-good); }
.check-ico.warn { background: var(--status-warning); color: #0b0b0b; }
.check-ico.bad { background: var(--status-critical); }
.check-row h4 { margin: 0; font-size: 14px; }
.check-row p { margin: 2px 0 0; font-size: 13px; color: var(--text-secondary); }
.score { font-size: 15px; font-weight: 700; }
ol.sources { padding-left: 20px; margin: 0; font-size: 13.5px; }
ol.sources li { margin-bottom: 6px; word-break: break-word; }

/* ---------- Chatbot ---------- */
.chat-wrap { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-top .bot-close { width: 34px; height: 34px; background: var(--surface-2); color: var(--text-primary); border: 1px solid var(--border); flex-shrink: 0; }
.chat-top .bot-close:hover { background: var(--grid); }
.chat-top .bot-close svg { width: 18px; height: 18px; }

/* ---------- Neural Chatbot side panel ---------- */
.bot-panel {
  position: fixed; top: var(--hdr); right: 0; bottom: 0; width: 430px; max-width: 100vw; z-index: 45;
  background: var(--page); border-left: 1px solid var(--border); box-shadow: -12px 0 40px rgba(0, 0, 0, .14);
  transform: translateX(105%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); visibility: hidden;
}
.bot-panel.open { transform: translateX(0); visibility: visible; }
.bot-inner { height: 100%; padding: 10px; display: flex; flex-direction: column; }
@media (min-width: 1240px) { body.bot-open .shell { padding-right: 430px; } }
.bot-fab {
  position: fixed; right: 20px; bottom: 22px; z-index: 44; display: inline-flex; align-items: center; gap: 10px;
  border: 0; cursor: pointer; color: #fff; font-weight: 700; font-size: 14.5px; padding: 10px 18px 10px 10px; border-radius: 999px;
  background: linear-gradient(135deg, #0b6b3a, #17a35d); box-shadow: 0 10px 28px rgba(11, 107, 58, .45);
  transition: transform .2s ease, opacity .2s ease;
}
.bot-fab:hover { transform: translateY(-2px); }
.bot-fab .fab-ico { width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 255, 255, .2); display: grid; place-items: center; }
.bot-fab .fab-ico svg { width: 22px; height: 22px; }
.bot-fab .fab-ping { position: absolute; top: 6px; left: 38px; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 0 rgba(246, 196, 69, .7); animation: ping 2s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(246, 196, 69, .7); } 80%, 100% { box-shadow: 0 0 0 12px rgba(246, 196, 69, 0); } }
body.bot-open .bot-fab { opacity: 0; pointer-events: none; transform: scale(.8); }
@media (max-width: 900px) {
  .bot-panel { top: 0; width: 100%; z-index: 70; border-left: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .bot-inner { padding: 8px; }
  .bot-fab { right: 14px; bottom: calc(74px + env(safe-area-inset-bottom)); padding: 8px; }
  .bot-fab .fab-txt { display: none; }
  .bot-fab .fab-ping { left: auto; right: 4px; top: 4px; }
  body.bot-open { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) { .bot-panel { transition: none; } .bot-fab .fab-ping { animation: none; } }
/* code lock */
.bot-lock { position: relative; margin: auto; width: 100%; max-width: 360px; text-align: center; padding: 26px 20px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); }
.bot-lock .lock-close { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; background: var(--surface-2); color: var(--text-primary); border: 1px solid var(--border); }
.bot-lock .lock-close svg { width: 18px; height: 18px; }
.lock-avatar { position: relative; width: 76px; height: 76px; margin: 0 auto 10px; border-radius: 22px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #0b6b3a, #1aa064); box-shadow: 0 8px 24px rgba(11, 107, 58, .35); }
.lock-avatar svg { width: 40px; height: 40px; }
.lock-badge { position: absolute; right: -8px; bottom: -6px; font-size: 20px; }
.bot-lock h3 { font-size: 19px; margin: 4px 0 6px; }
.lock-sub { font-size: 13.5px; color: var(--text-secondary); margin: 0 0 16px; line-height: 1.6; }
.lock-sub [lang="ur"] { font-family: var(--font-ur); font-size: 14px; }
.pin { display: flex; justify-content: center; gap: 10px; margin-bottom: 6px; }
.pin-box { width: 54px; height: 60px; text-align: center; font-size: 26px; font-weight: 700; border: 2px solid var(--baseline); border-radius: 14px; background: var(--surface-2); color: var(--text-primary); }
.pin-box:focus { outline: none; border-color: var(--brand); background: var(--surface-1); box-shadow: 0 0 0 4px var(--brand-soft); }
.pin.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.lock-langs { margin: 14px 0 0; }
.chat-top { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }
.bot-avatar { width: 38px; height: 38px; border-radius: 12px; background: linear-gradient(135deg, var(--brand), #1aa064); display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.bot-avatar svg { width: 22px; height: 22px; }
.chat-top .name { font-weight: 700; }
.chat-top .status { font-size: 12px; color: var(--text-muted); }
.chat-top .status .sdot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; vertical-align: 1px; }
.chat-top select { border: 1px solid var(--border); background: var(--surface-1); color: var(--text-primary); border-radius: 8px; padding: 5px 6px; font-size: 12.5px; }
.chat-log { flex: 1; overflow-y: auto; padding: 14px 12px; background: var(--surface-2); border-left: 1px solid var(--border); border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; padding: 10px 13px; border-radius: 16px; font-size: 14.5px; line-height: 1.5; word-wrap: break-word; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--brand); color: var(--on-brand); border-bottom-right-radius: 5px; white-space: pre-wrap; }
.msg.bot { align-self: flex-start; background: var(--surface-1); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.msg.bot p { margin: 0 0 8px; } .msg.bot p:last-child { margin-bottom: 0; }
.msg.bot ul, .msg.bot ol { margin: 4px 0 8px; padding-left: 20px; }
.msg.bot li { margin-bottom: 3px; }
.msg.bot h4 { margin: 4px 0 6px; font-size: 14.5px; }
.msg.bot table { border-collapse: collapse; font-size: 13px; margin: 6px 0; width: 100%; }
.msg.bot td, .msg.bot th { border-bottom: 1px solid var(--grid); padding: 5px 6px; text-align: left; }
.msg.bot td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.msg.bot code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: 13px; }
.msg.bot pre { background: var(--surface-2); padding: 10px; border-radius: 8px; overflow-x: auto; font-size: 12.5px; }
.msg-meta { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 11.5px; color: var(--text-muted); flex-wrap: wrap; }
.msg-meta button { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; padding: 0; font-size: 11.5px; text-decoration: underline; }
.typing { display: inline-flex; gap: 4px; align-items: center; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--axis); animation: blink 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 8px 10px; background: var(--surface-1); border-left: 1px solid var(--border); border-right: 1px solid var(--border); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-primary); border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.chip:hover { border-color: var(--brand); }
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); }
.composer textarea { flex: 1; resize: none; border: 1px solid var(--baseline); background: var(--surface-1); color: var(--text-primary); border-radius: 12px; padding: 10px 12px; font: inherit; font-size: 15px; max-height: 140px; min-height: 44px; }
.composer textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
.send-btn, .mic-btn { width: 44px; height: 44px; border-radius: 12px; border: 0; cursor: pointer; display: grid; place-items: center; flex-shrink: 0; }
.send-btn { background: var(--brand); color: var(--on-brand); }
.send-btn:disabled { opacity: .5; cursor: default; }
.mic-btn { background: var(--surface-2); color: var(--text-primary); border: 1px solid var(--border); }
.mic-btn.rec { background: var(--status-critical); color: #fff; }
.send-btn svg, .mic-btn svg { width: 20px; height: 20px; }

.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #222; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 300; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; }
.toast.show { opacity: 1; }
.steps { padding-left: 20px; margin: 6px 0; }
.steps li { margin-bottom: 6px; }
.kbd { display: inline-block; border: 1px solid var(--border); border-radius: 6px; padding: 0 6px; font-size: 12.5px; background: var(--surface-2); }
/* ---------- Urdu / Punjabi (right-to-left) chat bubbles ---------- */
.msg.rtl { font-family: var(--font-ur); font-size: 15.5px; line-height: 2; text-align: right; }
.msg.rtl bdi, .msg.rtl [dir="ltr"] { font-family: var(--font); line-height: 1.5; }
.msg.bot.rtl ul, .msg.bot.rtl ol { padding-left: 0; padding-right: 22px; }
.msg.bot.rtl td, .msg.bot.rtl th { text-align: right; }
.msg.bot.rtl td.n { text-align: left; }
.msg.bot.rtl { border-bottom-left-radius: 16px; border-bottom-right-radius: 5px; }
.msg.rtl .msg-meta { font-family: var(--font); line-height: 1.4; }
.chips .chip:lang(ur), .chip[dir="rtl"] { font-family: var(--font-ur); }

/* pictures inside chat answers */
.ans-pics { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.ans-pics .ap { margin: 0; width: 86px; text-align: center; }
.ans-pics img { width: 60px; height: 60px; border-radius: 14px; display: block; margin: 0 auto 4px; }
.ans-pics figcaption { font-size: 11.5px; line-height: 1.35; }
.ans-pics figcaption b { display: block; font-weight: 650; }
.ans-pics figcaption span { display: block; color: var(--text-muted); font-family: var(--font); font-size: 10.5px; }
.genfig { margin: 10px 0 0; }
.genfig img { display: block; width: 100%; max-width: 440px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); }
.genfig figcaption { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; font-family: var(--font); }
.genfig .btn { text-decoration: none; }
.gen-loading { display: flex; align-items: center; gap: 8px; padding: 14px; border-radius: 12px; background: var(--surface-2); font-size: 13px; color: var(--text-secondary); font-family: var(--font); }
.gen-fail { padding: 12px; border-radius: 12px; background: var(--surface-2); font-size: 13.5px; line-height: 1.6; }
.gen-fail .btn { margin-top: 6px; }

/* dashboard top-products strip */
.key-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: 0; }
.ts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 10px; }
.ts-item { display: flex; align-items: center; gap: 10px; text-align: left; border: 1px solid var(--border); background: var(--surface-2); border-radius: 14px; padding: 8px; cursor: pointer; color: inherit; min-width: 0; }
.ts-item:hover { border-color: var(--brand); }
.ts-item img { width: 52px; height: 52px; border-radius: 13px; flex-shrink: 0; }
.ts-txt { display: flex; flex-direction: column; min-width: 0; }
.ts-txt b { font-size: 13.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ts-ur { font-family: var(--font-ur); font-size: 12px; color: var(--text-secondary); line-height: 1.7; text-align: left; }
.ts-v { font-size: 14px; font-weight: 700; }
.ts-v small { font-weight: 500; color: var(--text-muted); font-size: 11px; }
.ts-more { display: inline-block; margin-top: 10px; font-size: 13px; font-weight: 600; text-decoration: none; }
@media (max-width: 420px) { .ts-grid { grid-template-columns: 1fr; } }
.chat-top .status { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* product picture gallery */
.section-title .st-ur { font-family: var(--font-ur); text-transform: none; letter-spacing: 0; font-weight: 600; margin-left: 6px; }
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 12px; }
.prod-card { position: relative; background: var(--surface-1); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; transition: transform .15s ease, box-shadow .15s ease; }
.prod-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0, 0, 0, .10); }
.pc-main { border: 0; background: transparent; color: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 14px 10px 8px; text-align: center; flex: 1; }
.pc-main img { width: 76px; height: 76px; border-radius: 18px; margin-bottom: 6px; }
.pc-name { font-weight: 650; font-size: 13.5px; line-height: 1.3; }
.pc-ur { font-family: var(--font-ur); font-size: 13px; color: var(--text-secondary); line-height: 1.8; }
.pc-val { font-size: 16px; font-weight: 750; margin-top: 2px; }
.pc-val span { font-size: 12px; margin-left: 4px; }
.pc-per { font-size: 11.5px; color: var(--text-muted); }
.pc-poster { border: 0; border-top: 1px solid var(--border); background: var(--surface-2); color: var(--text-secondary); font-size: 12.5px; font-weight: 600; padding: 7px; cursor: pointer; }
.pc-poster:hover { background: var(--brand-soft); color: var(--brand-strong); }
@media (max-width: 480px) { .prod-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } .pc-main img { width: 64px; height: 64px; } }

@media print { .topbar, .sidenav, .bottomnav, .chat-wrap, .bot-panel, .bot-fab { display: none !important; } }
