/* ============================================================
   Sanjha design — sab projects ek jaise dikhte hain.
   Yahan koi rang hardcode nahi; sab shared/theme/tokens.css se.

   Shakl: sheesha (glass) + aurora. Card aur patti aadhe shafaaf hain aur
   peeche ka rang un mein se jhalakta hai; peeche ek bohat halki chalti hui
   roshni hai. Dono cheezen jaan boojh kar **halki** rakhi hain — ye
   software dukan par purane computer par chalta hai, aur bhaari asar wahan
   safha atakne lagta hai.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

/* `hidden` hamesha chalna chahiye.
   Ye purani CSS ki chaal hai: browser ka apna `[hidden] { display: none }`
   bohot kamzor hota hai, aur koi bhi `display: grid` ya `display: flex`
   us par bhaari par jata hai. Nateeja: cheez chhupti hi nahi, aur ghalti
   dhoondhne mein waqt lagta hai kyunki JavaScript bilkul theek chal raha
   hota hai. (Fast Food ki order screen par yahi hua tha — category ke
   buttons dabte the magar saari qismein ek saath nazar aati thin.) */
[hidden] { display: none !important; }

/* Rang `html` par hai, `body` par nahi — aur ye jaan boojh kar hai.
   Aurora `body` ke andar hai; agar `body` ka apna rang ho to wo aurora ke
   upar chhap jata hai aur peeche ki roshni bilkul nazar nahi aati. */
html { background: var(--bg); }
html, body {
  margin: 0; padding: 0;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  /* Purani machine par bhi seedha rehna chahiye */
  -webkit-text-size-adjust: 100%;
}

/* Urdu chunte hi poori screen ulat jati hai — <html dir="rtl"> se */
html[lang="ur"] body { font-family: var(--font-urdu); font-size: 16px; line-height: 1.9; }

/* ---------------- Aurora — peeche ki halki roshni ----------------
   Ye <body> ke peeche do bare, dhundle daire hain jo bohat aahista
   khiskte hain. Maqsad ye ke safha bilkul chapta na lage.

   Do baatein jaan boojh kar:
     * `position: fixed` — scroll ke saath nahi chalta, warna har scroll
       par browser ko dobara banana parta aur safha atakta.
     * chalne wali harkat sirf wahan jahan bandah ne mana nahi kiya
       (prefers-reduced-motion neeche). */
.aurora {
  position: fixed; inset: 0; z-index: 0;
  overflow: hidden; pointer-events: none;
}
/* Sara kaam aurora ke upar */
.layout, .login-page { position: relative; z-index: 1; }
.aurora::before, .aurora::after {
  content: ""; position: absolute;
  width: 46vw; height: 46vw; min-width: 380px; min-height: 380px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .34;
}
.aurora::before {
  background: var(--accent-1);
  top: -14vw; inset-inline-start: -10vw;
  animation: aurora-1 26s ease-in-out infinite alternate;
}
.aurora::after {
  background: var(--accent-2);
  bottom: -18vw; inset-inline-end: -12vw;
  animation: aurora-2 32s ease-in-out infinite alternate;
}
@keyframes aurora-1 {
  from { transform: translate3d(0, 0, 0)      scale(1); }
  to   { transform: translate3d(6vw, 5vh, 0)  scale(1.15); }
}
@keyframes aurora-2 {
  from { transform: translate3d(0, 0, 0)       scale(1.1); }
  to   { transform: translate3d(-5vw, -6vh, 0) scale(1); }
}

/* Link ka rang.
   Ye pehle tay hi nahi tha, yani browser ka apna gehra neela chalta tha.
   Light mein wo guzar jata hai — dark mein kaale par gehra neela bilkul
   nazar nahi aata, aur table ke saare naam ghayab lagte the. */
a { color: var(--primary); }
a:hover { color: var(--primary-hover); }

/* Paise aur tadaad — hamesha 0-9, qatar mein seedhe.
   (Urdu ke ۰۱۲۳ nahi — dukandaar 0-9 hi parhta hai.) */
.num, td.num, .money {
  font-family: var(--font-number);
  font-variant-numeric: tabular-nums;
  direction: ltr;              /* RTL mein bhi number seedha rahe */
  unicode-bidi: embed;
  text-align: end;
}

/* Table ka sirnama alag maamla hai: us mein number nahi, ALFAZ hote hain.
   `direction: ltr` aur number wala font us par lagane se Urdu ke harf
   aapas mein jurte hi nahi — "بقایہ" toot kar "ب ق ا ی ہ" ban jata tha.
   Sirnama ko sirf qatar ke saath seedha rakhna kaafi hai. */
th.num { text-align: end; }

/* --- Keyboard se chalne wale ke liye: focus HAMESHA saaf dikhe --- */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---------------- Dhancha ---------------- */

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 244px; flex-shrink: 0;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
          backdrop-filter: var(--blur);
  border-inline-end: 1px solid var(--border);   /* RTL mein khud palat jata hai */
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}

/* Brand: gradient wali tikiya + naam.
   Tikiya par dukan ke naam ke pehle do harf aate hain — chhoti si cheez
   hai magar client ko fauran lagta hai ke software "uska" hai. */
.brand { display: flex; align-items: center; gap: 11px; padding: 18px 16px; }
.brand-badge {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: var(--radius);
  background: var(--gradient);
  box-shadow: var(--glow);
  color: #fff; font-weight: 800; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: .5px;
  /* Harf hamesha Latin shakl mein — Urdu mein bhi tikiya seedhi rahe */
  direction: ltr;
}
.brand-text { min-width: 0; }
.brand-name { font-weight: 700; font-size: 15px; line-height: 1.25; }
.brand-shop {
  color: var(--text-muted); font-size: 12.5px; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.nav { padding: 6px 10px 10px; flex: 1; overflow-y: auto; }

/* Chhota sa sirnama — MAIN / MANAGE wagera. Lambi fehrist ko tukron mein
   baant deta hai, aur nazar ko dobara dhoondhne mein madad milti hai. */
.nav-section {
  font-size: 10.5px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--text-faint);
  padding: 14px 12px 6px;
}
html[lang="ur"] .nav-section { letter-spacing: normal; font-size: 12px; }

.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--text-muted); text-decoration: none;
  font-weight: 500; font-size: 14.5px;
  min-height: 42px;
  transition: background .14s, color .14s;
}
.nav a svg { width: 19px; height: 19px; flex-shrink: 0; opacity: .85; }
.nav a:hover { background: var(--surface-2); color: var(--text); }

/* Chuna hua khana: halka sa banafshi khana + gehra harf.
   Pehle poora khana bhar diya jata tha (thos rang). Wo saaf to tha magar
   bhaari lagta tha aur nazar ko baar baar apni taraf khenchta tha. */
.nav a.active {
  background: var(--primary-soft);
  color: var(--primary-soft-text);
  font-weight: 650;
}
.nav a.active svg { opacity: 1; }
.nav .key {
  margin-inline-start: auto; font-size: 10.5px; opacity: .7;
  font-family: var(--font-mono);
  border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px;
}

.sidebar-foot { padding: 12px; border-block-start: 1px solid var(--border); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------------- Upar wali patti ---------------- */

.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px var(--gap-lg);
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
          backdrop-filter: var(--blur);
  border-block-end: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.topbar .spacer { flex: 1; }

/* Zaban ka khana — teen harf, ek patti mein. Pehle ye ek dropdown tha;
   dropdown mein bandah ko pehle kholna parta hai phir chunna. Teen zabanon
   ke liye teen button behtar hain: mojooda zaban hamesha nazar aati hai. */
.seg {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 3px;
}
.seg button {
  border: 0; background: transparent; color: var(--text-muted);
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 5px 13px; border-radius: var(--radius-pill);
  cursor: pointer; white-space: nowrap;
  min-height: 30px;
}
.seg button:hover { color: var(--text); }
.seg button svg { width: 17px; height: 17px; display: block; }
/* Sirf nishan wale button — alfaz wale se tang */
.seg-icons button { padding: 5px 9px; }
.seg button[aria-pressed="true"] {
  background: var(--surface); color: var(--primary-soft-text);
  box-shadow: var(--shadow-sm);
}

/* Gol button — theme badalne wala chaand */
.icon-btn {
  width: 38px; height: 38px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 50%;
  background: var(--surface); color: var(--text-muted);
  cursor: pointer; padding: 0;
  transition: background .14s, color .14s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

/* Banda kaun hai — gol nishan + naam + darja */
.user-chip {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 4px 12px 4px 4px; border-radius: var(--radius-pill);
  background: var(--surface); border: 1px solid var(--border);
  text-decoration: none; color: var(--text);
}
html[dir="rtl"] .user-chip { padding: 4px 4px 4px 12px; }
.user-chip:hover { background: var(--surface-2); }
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--gradient); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12.5px; direction: ltr;
}
.user-name { font-size: 13px; font-weight: 650; line-height: 1.15; }
.user-role { font-size: 11px; color: var(--text-muted); line-height: 1.15; }

.content { padding: var(--gap-lg); flex: 1; }

/* Safhe ka bara sirnama — patti wale chhote sirname se alag.
   Neeche aaj ki tareekh, kyunke dukandaar ka har hisab "aaj" se shuru hota hai. */
.page-head { margin-bottom: 18px; }
.page-head h2 { margin: 0; font-size: 27px; font-weight: 800; letter-spacing: -.02em; }
.page-head .sub { color: var(--text-muted); font-size: 13.5px; margin-top: 3px; }

/* ---------------- Cards aur khaanay ---------------- */

.card {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
          backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--gap-lg);
  margin-bottom: var(--gap-lg);
}
.card h2 { margin: 0 0 var(--gap); font-size: 15.5px; font-weight: 700; }

/* Card jis mein koi khulne wala khana ho (dhoondne ka dropdown, waghera).
 *
 * `.card` par `backdrop-filter` hai -- aur backdrop-filter apna alag
 * "stacking context" bana deta hai. Us ka matlab ye hai ke card ke ANDAR ka
 * `z-index` bahar kaam nahi karta: dropdown chahe z-index 999 rakhe, agla
 * card us ke upar chhap jata hai.
 *
 * Ye aankh se hi pakra jata hai -- HTML theek hota hai, status code 200 hota
 * hai, sirf dekhne mein dropdown aadha chhupa hota hai. Aur pakre jaane ki
 * jagah wohi hai jahan sab se zyada nuqsan hai: nai bikri ka safha, jab
 * dukandar ke saamne gaahak khara ho.
 *
 * Is liye jis card mein dropdown ho, poore card ko upar utha do. 5 rakha hai
 * -- doosre card (0) se upar, magar upar wali patti (20) se neeche, taake
 * scroll karte waqt dropdown patti ke upar na chadh jaye.
 *
 * `:has()` sirf ehtiyat hai -- agar kal koi naya dropdown likhe aur class
 * lagana bhool jaye. Asal pehra `shared/tests/test_dropdown_ka_upar.py` hai.
 */
.card.has-popup { position: relative; z-index: 5; }
.card:has(div.hits, div.results) { position: relative; z-index: 5; }

/* ---------------- Dhoondne ka dropdown ---------------- */
/*
 * Ye pehle SAAT templates mein alag alag copy hua para tha, aur `offers.html`
 * mein copy karna reh gaya tha -- wahan dropdown bilkul be-shakl khulta tha:
 * naam, packing aur rate ek doosre se chipke huay, aur poora form neeche
 * khisak jata tha. Test 200 deta raha, kyunki HTML poori tarah theek tha.
 *
 * Ab panel ka roop yahan ek hi jagah hai. Har safhe ki apni zaroorat sirf
 * `.hit` ke column hain (kitne khane dikhane hain) -- wo hi wahan likhe
 * jate hain, baqi sab yahan se milta hai.
 */
/* Jis khane ke neeche dropdown khulta hai us par `find` class lagti hai --
 * `.hits` isi ke naap se lagta hai. `offers.html` mein class to likhi hui
 * thi magar CSS mein us ka koi matlab hi nahi tha, is liye dropdown poore
 * card ke naap ka ban jata tha. */
.find { position: relative; }

.hits {
  position: absolute; inset-inline: 0; inset-block-start: 100%; z-index: 30;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: 0 10px 24px rgba(0, 0, 0, .18);
  max-height: 340px; overflow-y: auto;
}
.hits:empty { display: none; }

.hit {
  display: grid; grid-template-columns: 2fr .9fr .8fr; gap: 10px;
  padding: 9px 12px; border-block-end: 1px solid var(--border);
  color: var(--text); text-decoration: none; align-items: baseline;
  width: 100%; text-align: start; background: none;
  border-inline: 0; border-block-start: 0; cursor: pointer; font: inherit;
}
.hit:last-child { border-block-end: 0; }
.hit.on, .hit:hover, .hit:focus { background: var(--primary); color: var(--primary-text); }
.hit-name { font-weight: 600; }
.hit-meta { font-size: .85em; opacity: .85; }
@media (max-width: 700px) { .hit { grid-template-columns: 1fr 1fr; } }

/* Card ka sirnama + daayen taraf koi link ("sab dekhein") */
.card-head {
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 14px;
}
.card-head h2 { margin: 0; flex: 1; }
.card-head a { font-size: 13px; font-weight: 600; color: var(--primary); text-decoration: none; }
.card-head a:hover { text-decoration: underline; }

/* ---------------- Dashboard ke khane ---------------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: var(--gap-lg); }

.stat {
  position: relative; overflow: hidden;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
          backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px;
  transition: transform .16s ease, box-shadow .16s ease;
}
/* Halka sa ujala kone mein — card ko chapta hone se bachata hai */
.stat::after {
  content: ""; position: absolute; top: -30px; inset-inline-end: -30px;
  width: 150px; height: 150px; border-radius: 50%;
  /* Thos daire ki dhaar kati hui nazar aati thi. Gradient ke kinare
     ghul jate hain, is liye ujala ujala hi lagta hai — dhabba nahi. */
  background: radial-gradient(circle, var(--tile-bg, var(--tile-glow)) 0%,
                              transparent 70%);
  opacity: .85; pointer-events: none;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

/* Nishan ki tikiya — har khane ka apna rang.
   `data-tile="2"` likhne se rang badal jata hai; rang tokens se aata hai. */
.stat-icon {
  width: 42px; height: 42px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  background: var(--tile-bg, var(--primary-soft));
  color: var(--tile-fg, var(--primary-soft-text));
  margin-bottom: 14px; position: relative; z-index: 1;
}
.stat-icon svg { width: 21px; height: 21px; }
[data-tile="1"] { --tile-bg: var(--tile-1-bg); --tile-fg: var(--tile-1-fg); }
[data-tile="2"] { --tile-bg: var(--tile-2-bg); --tile-fg: var(--tile-2-fg); }
[data-tile="3"] { --tile-bg: var(--tile-3-bg); --tile-fg: var(--tile-3-fg); }
[data-tile="4"] { --tile-bg: var(--tile-4-bg); --tile-fg: var(--tile-4-fg); }
[data-tile="5"] { --tile-bg: var(--tile-5-bg); --tile-fg: var(--tile-5-fg); }
[data-tile="6"] { --tile-bg: var(--tile-6-bg); --tile-fg: var(--tile-6-fg); }

.stat-label { color: var(--text-muted); font-size: 13px; font-weight: 600; position: relative; z-index: 1; }
.stat-value {
  font-size: 28px; font-weight: 800; margin-top: 4px;
  font-family: var(--font-number); font-variant-numeric: tabular-nums;
  letter-spacing: -.02em; position: relative; z-index: 1;
  direction: ltr; text-align: start;
}
html[dir="rtl"] .stat-value { text-align: right; }
.stat-foot { font-size: 12.5px; margin-top: 7px; color: var(--text-muted); position: relative; z-index: 1; }
.stat-foot.up   { color: var(--success); font-weight: 600; }
.stat-foot.down { color: var(--danger);  font-weight: 600; }
.stat.good .stat-value { color: var(--success); }
.stat.warn .stat-value { color: var(--warning); }

/* ---------------- Tables ---------------- */

.table-wrap { overflow-x: auto; }        /* chhoti screen par table khud scroll kare */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 12px; text-align: start; border-block-end: 1px solid var(--border); }
th {
  background: transparent;
  font-weight: 700; font-size: 11px; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: .06em; white-space: nowrap;
}
html[lang="ur"] th { text-transform: none; letter-spacing: normal; font-size: 13px; }

/* Raqam kabhi do lines mein na toote -- "Rs" upar aur "12,570.00" neeche
 * parhne mein bura lagta hai aur ginti mein dhoka deta hai. */
td.num { white-space: nowrap; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-block-end: 0; }
tfoot td { font-weight: 800; border-block-start: 2px solid var(--border-strong); }

/* ---------------- Form ---------------- */

label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; }
input, select, textarea {
  width: 100%;
  min-height: var(--control-h);
  padding: 8px 13px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 15px;
  transition: border-color .14s, box-shadow .14s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
input[type="number"], input.money { font-family: var(--font-number); text-align: end; }

.field { margin-bottom: var(--gap); }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--gap); }

/* ---------------- Buttons ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--control-h); padding: 0 18px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 650;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .12s ease, background .14s, box-shadow .14s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; }

/* Asal button gradient par hai — poore software mein ek hi rang ka rasta */
.btn-primary {
  background: var(--gradient); border-color: transparent;
  color: #fff; box-shadow: var(--glow);
}
.btn-primary:hover { background: var(--gradient); filter: brightness(1.07); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: var(--danger-bg); }
.btn-lg { min-height: var(--control-h-lg); font-size: 17px; padding: 0 26px; border-radius: var(--radius); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; font-weight: 600; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn .key { font-size: 11px; opacity: .8; font-family: var(--font-mono); border: 1px solid currentColor; border-radius: 4px; padding: 1px 5px; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------- Nishaan (badges) aur paighaam ---------------- */

.badge { display: inline-block; padding: 3px 10px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 700; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-info    { background: var(--info-bg);    color: var(--info); }

.alert {
  padding: 13px 16px; border-radius: var(--radius);
  margin-bottom: var(--gap); border: 1px solid;
}
.alert-success { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.alert-danger  { background: var(--danger-bg);  border-color: var(--danger);  color: var(--danger); }
.alert-warning { background: var(--warning-bg); border-color: var(--warning); color: var(--warning); }
.alert-info    { background: var(--info-bg);    border-color: var(--info);    color: var(--info); }

.empty { text-align: center; padding: 48px 20px; color: var(--text-muted); }

.muted { color: var(--text-muted); }
.small { font-size: 13px; }

/* ---------------- Keyboard ki madad ka patti ---------------- */

.keybar {
  display: flex; gap: 16px; flex-wrap: wrap;
  padding: 9px var(--gap-lg);
  background: var(--surface-2);
  border-block-start: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted);
}
.keybar kbd {
  font-family: var(--font-mono); font-size: 11px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 5px;
  padding: 2px 6px; margin-inline-end: 5px;
}

/* ---------------- Chhupa hua khana (copy ke liye) ----------------
   "Copy" ka purana totka tha: textarea ko `left: -9999px` par bhej do.
   Wo Angrezi mein chalta hai — safhe ke baayen taraf ki cheez scroll mein
   ginti hi nahi.

   Urdu mein bilkul ulta ho jata hai. RTL mein safha daayen se shuru hota
   hai, is liye wohi -9999px ab "aage" ki taraf ho jata hai aur safha
   gyarah hazar pixel chaura ban jata hai. Nateeja: Urdu chunte hi poora
   safha khisak jata tha aur khali screen nazar aati thi.

   `position: fixed` kabhi scroll ki chaurai nahi barhata — na LTR mein,
   na RTL mein. Aur naap 1px + `opacity: 0` rakha hai, hataya nahi:
   `display: none` ya `visibility: hidden` wale khane se copy nahi hota. */
.copy-source {
  position: fixed; top: 0; inset-inline-start: 0;
  width: 1px; height: 1px;
  opacity: 0; pointer-events: none;
  border: 0; padding: 0; resize: none;
}

/* ---------------- Login ka safha ---------------- */

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-box { width: 100%; max-width: 400px; }
.login-box .card { padding: 28px; }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand .brand-badge { width: 54px; height: 54px; font-size: 19px; margin: 0 auto 12px; border-radius: var(--radius-lg); }
.login-brand h1 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.login-brand .sub { color: var(--text-muted); font-size: 13.5px; margin-top: 3px; }

/* ---------------- Chhoti screen (phone/tablet) ---------------- */

@media (max-width: 820px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: static;
    border-inline-end: none; border-block-end: 1px solid var(--border);
  }
  .nav { display: flex; overflow-x: auto; padding: 8px; }
  .nav a { white-space: nowrap; }
  .nav .key { display: none; }
  .nav-section { display: none; }     /* patti ki shakl mein sirnama bemani hai */
  .sidebar-foot { display: none; }    /* naam upar user-chip mein pehle se hai */
  .content { padding: var(--gap); }
  .page-head h2 { font-size: 22px; }

  /* Chhoti screen par upar wali patti neeche wrap ho jaye.
     Warna zaban aur theme wale khane chaurai se bahar nikal jate hain
     aur poora safha aage peeche khiskne lagta hai. */
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  .topbar h1 { flex: 1 1 100%; }
  .topbar .spacer { display: none; }
  .user-name, .user-role { display: none; }
  .user-chip { padding: 4px; }
}

/* Safha kabhi bhi aage peeche nahi khiskna chahiye — chaurai wali cheezen
   (tables, lambi lines) apne andar scroll karti hain, poora safha nahi. */
body { overflow-x: hidden; }

/* ---------------- Jinhein harkat na chahiye ----------------
   Kuch logon ko chalti hui cheezon se chakkar aata hai; Windows mein iske
   liye apni setting hai. Wo lagi ho to aurora ruk jati hai aur cheezein
   uchhalna band kar deti hain. Shakl wahi rehti hai. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .stat:hover { transform: none; }
  .btn:active { transform: none; }
}

/* ---------------- Chhapai ---------------- */

@media print {
  .sidebar, .topbar, .keybar, .aurora, .no-print { display: none !important; }
  .content { padding: 0; }
  .card, .stat {
    border: none; box-shadow: none; padding: 0; margin: 0;
    background: #fff;
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  body { background: #fff; }
}

/* ---------------- Demo wali patti ----------------
   Sab se upar, har safhe par, aur chhupti nahi. Bandah demo mein bikri
   karta hai aur wo sab kuch raat ko gayab ho jata hai — agar ye baat usay
   pehle se maloom na ho to bharosa software par se uthta hai, demo par se
   nahi (shared/web/demo.py). */

.demo-patti {
  position: sticky; top: 0; z-index: 60;
  padding: 7px 16px;
  text-align: center;
  font-size: 13px; font-weight: 700; letter-spacing: .02em;
  background: var(--warning-bg); color: var(--warning);
  border-bottom: 1px solid var(--warning);
}
