/* ============================================================
   Farooqia Portal — style.css
   RTL Urdu ERP · sabz jild · sidebar dayen taraf
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&family=Noto+Nastaliq+Urdu:wght@400;500;600;700&family=Noto+Naskh+Arabic:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

:root {
  --ink:       #15201B;
  --ink-2:     #47574F;
  --ink-3:     #7C8C83;

  --green-950: #06231B;
  --green-900: #0A3226;
  --green-800: #0E4433;
  --green-700: #135941;
  --green-600: #1B6E52;
  --green-50:  #E8F1EC;

  --brass:     #BE9243;
  --brass-2:   #E0C48A;
  --brass-50:  #F8F1E0;

  --red:       #93302A;
  --red-50:    #F8EBE9;
  --blue:      #24566E;
  --blue-50:   #E9F0F4;

  --bg:        #F4F1E9;
  --white:     #FFFFFF;
  --line:      #E2DBCA;
  --line-2:    #EFEADE;

  --nastaliq: 'Noto Nastaliq Urdu', serif;
  --naskh:    'Noto Naskh Arabic', 'Segoe UI', Tahoma, sans-serif;
  --num:      'IBM Plex Sans', 'Segoe UI', sans-serif;
  --amiri:    'Amiri', 'Noto Naskh Arabic', serif;

  --r:   12px;
  --r-s: 9px;
  --shadow:    0 1px 2px rgba(6,35,27,.05), 0 10px 26px -16px rgba(6,35,27,.22);
  --shadow-sm: 0 1px 2px rgba(6,35,27,.06);
  --sidebar-w: 268px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: var(--naskh);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px; line-height: 1.9;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--green-800); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

.nastaliq { font-family: var(--nastaliq); line-height: 2.4; padding-block: .12em; }

.num, td.num, th.num, .stat-value, .kpi { 
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  direction: ltr;
}

/* ============================================================ LOGIN */

.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; }

/* ---- سبز پہلو: نام، نقش، آیت ---- */

.login-brand {
  background: var(--green-950);
  color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 54px 44px;
  position: relative; overflow: hidden;
}

/* اسلامی ہندسی نقش — آٹھ کونوں والا ستارہ */
.login-brand::before {
  content: ''; position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='92' height='92' viewBox='0 0 92 92'%3E%3Cg fill='none' stroke='%23BE9243' stroke-width='1'%3E%3Cpath d='M46 5 L57 35 L87 46 L57 57 L46 87 L35 57 L5 46 L35 35 Z'/%3E%3Crect x='24' y='24' width='44' height='44'/%3E%3Crect x='24' y='24' width='44' height='44' transform='rotate(45 46 46)'/%3E%3Ccircle cx='46' cy='46' r='13'/%3E%3C/g%3E%3C/svg%3E");
  opacity: .12;
}

/* سنہری دوہری حاشیہ */
.login-brand::after {
  content: ''; position: absolute; inset: 24px;
  border: 1px solid rgba(190,146,67,.55);
  box-shadow: inset 0 0 0 7px var(--green-950), inset 0 0 0 8px rgba(190,146,67,.25);
  pointer-events: none;
}

.brand-inner {
  position: relative; z-index: 1;
  text-align: center; max-width: 560px; width: 100%;
  animation: settle 1s cubic-bezier(.2,.7,.3,1) both;
}
@keyframes settle { from { opacity:0; transform: translateY(16px);} to { opacity:1; transform:none; } }
@media (prefers-reduced-motion: reduce) { .brand-inner { animation: none; } }

/* سبز پہلو پر لوگو */
.brand-logo {
  width: clamp(96px, 10vw, 128px);
  height: clamp(96px, 10vw, 128px);
  margin: 0 auto 24px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(190,146,67,.7);
  box-shadow: 0 0 0 7px rgba(255,255,255,.06);
  display: grid; place-items: center;
  padding: 8px;
  flex: 0 0 auto;
}
.brand-logo img {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  object-fit: contain; display: block;
}

.brand-name {
  font-family: var(--nastaliq);
  font-size: clamp(28px, 3.5vw, 44px);
  line-height: 2.45; font-weight: 700;
  margin: 0; padding-block: .15em;
  text-shadow: 0 2px 18px rgba(0,0,0,.35);
}

.brand-sub {
  font-size: 16.5px; color: var(--brass-2);
  margin: 6px 0 0; line-height: 2.1;
}

/* سنہری زیور — دو لکیریں اور بیچ میں ہیرا */
.ornament {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; margin: 26px auto 30px; max-width: 260px;
}
.ornament i { flex: 1; height: 1px; background: linear-gradient(to left, transparent, var(--brass)); }
.ornament i:last-child { background: linear-gradient(to right, transparent, var(--brass)); }
.ornament b {
  width: 9px; height: 9px; background: var(--brass);
  transform: rotate(45deg); flex: 0 0 9px;
}

/* آیت کا کتبہ */
.ayah {
  border: 1px solid rgba(190,146,67,.4);
  border-radius: 4px;
  padding: 24px 26px 20px;
  background: rgba(0,0,0,.18);
  position: relative;
}
.ayah::before, .ayah::after {
  content: '❖';
  position: absolute; top: -11px;
  color: var(--brass); background: var(--green-950);
  font-size: 13px; line-height: 1; padding: 3px 7px;
}
.ayah::before { right: 22px; }
.ayah::after  { left: 22px; }

.ayah-ar {
  font-family: var(--amiri);
  font-size: clamp(19px, 2.1vw, 25px);
  line-height: 2.1; color: #fff;
  margin: 0 0 14px; font-weight: 400;
}
.ayah-ur {
  font-family: var(--nastaliq);
  font-size: 15px; line-height: 2.4;
  color: rgba(247,244,236,.9);
  margin: 0; padding-block: .1em;
}
.ayah-ref {
  display: block; margin-top: 12px;
  font-family: var(--naskh); font-size: 13.5px;
  color: var(--brass-2); letter-spacing: .02em;
}

/* ---- سفید پہلو: فارم ---- */

.login-form-side {
  display: flex; align-items: center; justify-content: center;
  padding: 48px 34px; background: var(--bg);
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 38px 34px 30px;
  box-shadow: 0 1px 3px rgba(6,35,27,.05), 0 24px 48px -30px rgba(6,35,27,.4);
  position: relative;
  text-align: center;
}
.login-card::before {
  content: ''; position: absolute; top: -1px; right: 34px; left: 34px;
  height: 3px; border-radius: 0 0 3px 3px;
  background: linear-gradient(to left, var(--brass-2), var(--brass), var(--brass-2));
}
.login-card .field, .login-card form { text-align: right; }

.login-seal {
  width: 62px; height: 62px; margin: 0 auto 20px;
  border-radius: 50%;
  border: 1px solid var(--brass);
  box-shadow: inset 0 0 0 4px var(--bg), inset 0 0 0 5px rgba(190,146,67,.35);
  display: grid; place-items: center;
  font-family: var(--nastaliq); font-size: 24px;
  color: var(--green-800); line-height: 1;
  overflow: hidden;
}
.login-seal img { max-width: 76%; max-height: 76%; width: auto; height: auto;
                  object-fit: contain; display: block; }

/* سائیڈ بار کی مہر */
.sb-seal img { max-width: 80%; max-height: 80%; width: auto; height: auto;
               object-fit: contain; display: block; }
.sb-seal { overflow: hidden; background: rgba(255,255,255,.9); }
.sb-seal.has-logo { border-color: rgba(190,146,67,.8); }

/* رپورٹ کے سر پر لوگو */
.sheet-logo {
  width: 66px; height: 66px; margin: 0 auto 10px;
  display: grid; place-items: center;
}
.sheet-logo img { max-width: 100%; max-height: 100%; width: auto; height: auto;
                  object-fit: contain; display: block; }

.login-card h2 {
  font-family: var(--nastaliq);
  font-size: 26px; line-height: 2.3; font-weight: 700;
  margin: 0 0 2px; padding-block: .1em;
}
.login-card .hint { color: var(--ink-2); font-size: 15px; margin: 0 0 26px; }

.login-card .btn-block { height: 48px; font-size: 16px; margin-top: 4px; }

.login-foot {
  margin: 24px 0 0; padding-top: 18px;
  border-top: 1px solid var(--line-2);
  font-size: 13.5px; color: var(--ink-3); line-height: 2;
  text-align: center;
}
.login-foot a { color: var(--green-700); }

@media (max-width: 900px) {
  .login-page { grid-template-columns: 1fr; }
  .login-brand { padding: 40px 22px; }
  .login-brand::after { inset: 14px; box-shadow: inset 0 0 0 5px var(--green-950), inset 0 0 0 6px rgba(190,146,67,.25); }
  .ornament { margin: 20px auto 22px; }
  .ayah { padding: 20px 18px 16px; }
  .ayah-ar { font-size: 19px; line-height: 2; }
  .ayah-ur { font-size: 14px; }
  .login-form-side { padding: 30px 16px 46px; }
  .login-card { padding: 30px 22px 26px; border-radius: var(--r-s); }
  .login-card::before { right: 22px; left: 22px; }
  .login-seal { width: 54px; height: 54px; font-size: 22px; margin-bottom: 16px; }
  .brand-logo { width: 82px; height: 82px; margin-bottom: 18px; padding: 9px; }
}

/* ============================================================ FORM · BUTTON · ALERT */

.field { margin-bottom: 18px; }

.field label {
  display: block; font-size: 14.5px; font-weight: 600;
  margin-bottom: 8px; color: var(--ink);
}

.field input, .ctl, textarea.ctl {
  display: block; width: 100%; height: 46px;
  padding: 0 15px;
  font-family: var(--naskh); font-size: 16px; color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line); border-radius: var(--r-s);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input::placeholder, .ctl::placeholder { color: var(--ink-3); }

.field input:focus, .ctl:focus, textarea.ctl:focus {
  border-color: var(--green-600); outline: none;
  box-shadow: 0 0 0 3px rgba(27,110,82,.14);
}

textarea.ctl { height: auto; padding: 12px 15px; line-height: 1.9; }
.field input[type=file] { height: auto; padding: 11px 15px; font-size: 15px; }
.field input[type=date] { direction: ltr; text-align: right; }

/* Sab buttons ek hi qad par */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; width: auto;
  font-family: var(--naskh); font-size: 15.5px; font-weight: 600;
  color: #fff; background: var(--green-800);
  border: 1px solid var(--green-800); border-radius: var(--r-s);
  cursor: pointer; white-space: nowrap; line-height: 1;
  transition: background .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--green-900); border-color: var(--green-900); text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-block { width: 100%; }

.btn-ghost {
  background: var(--white); color: var(--ink-2);
  border-color: var(--line); font-weight: 500;
}
.btn-ghost:hover { background: var(--bg); color: var(--ink); border-color: var(--line); }

.btn-danger { background: var(--white); color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }

.btn svg { width: 17px; height: 17px; flex: 0 0 17px; }

/* Ittila'at */
.alert {
  padding: 13px 16px; border-radius: var(--r-s); font-size: 15px;
  margin-bottom: 22px; line-height: 1.9;
  border-right: 3px solid var(--red);
  background: var(--red-50); color: var(--red);
}
.alert-ok   { border-right-color: var(--green-600); background: var(--green-50); color: var(--green-700); }
.alert-note { border-right-color: var(--brass);     background: var(--brass-50); color: #6E5220; }

/* ============================================================ SHELL */

.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  grid-column: 1; grid-row: 1;          /* RTL: pehla track = dayen */
  background: var(--green-950); color: var(--bg);
  display: flex; flex-direction: column;
  padding: 22px 0 18px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}

.sb-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px 18px; margin-bottom: 6px;
  border-bottom: 1px solid rgba(190,146,67,.28);
}
.sb-seal {
  width: 40px; height: 40px; flex: 0 0 40px;
  border-radius: 50%; border: 1px solid var(--brass);
  display: grid; place-items: center;
  font-family: var(--nastaliq); font-size: 17px; color: var(--brass-2);
  line-height: 1;
}
.sb-brand p {
  font-family: var(--nastaliq); font-size: 16px; line-height: 2.1;
  font-weight: 600; margin: 0; padding-block: .1em;
}

.nav { padding: 4px 0 10px; }

.nav-group {
  padding: 14px 20px 6px;
  font-size: 12.5px; color: rgba(190,146,67,.9);
}

.nav a, .nav .off {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 20px; font-size: 15.5px;
  color: rgba(244,241,233,.8);
  border-right: 3px solid transparent;
  transition: background .15s ease, color .15s ease;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav a.active {
  background: rgba(190,146,67,.15);
  border-right-color: var(--brass);
  color: #fff; font-weight: 600;
}
.nav svg { width: 18px; height: 18px; flex: 0 0 18px; opacity: .85; }
.nav a.active svg { opacity: 1; color: var(--brass-2); }

.nav .off { color: rgba(244,241,233,.3); cursor: default; }
.nav .off em {
  font-style: normal; font-size: 11.5px; margin-right: auto;
  color: rgba(190,146,67,.75);
  border: 1px solid rgba(190,146,67,.3);
  border-radius: 20px; padding: 0 9px; line-height: 1.9;
}

.sb-foot {
  margin-top: auto; padding: 14px 20px 0;
  border-top: 1px solid rgba(190,146,67,.28);
  display: flex; align-items: center; gap: 11px;
}
.sb-avatar {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%;
  background: rgba(190,146,67,.22); color: var(--brass-2);
  display: grid; place-items: center; font-size: 15px; font-weight: 600;
}
.sb-foot .who { min-width: 0; font-size: 14px; line-height: 1.6; }
.sb-foot .who b { display: block; font-weight: 600; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-foot .who span { color: var(--brass-2); font-size: 12.5px; }

/* ---------- MAIN ---------- */

.main { grid-column: 2; grid-row: 1; min-width: 0; }

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  padding: 14px 32px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 5;
}
.topbar h1 {
  font-family: var(--nastaliq); font-size: 22px; line-height: 2.1;
  font-weight: 700; margin: 0; padding-block: .08em;
}
.topbar .meta { color: var(--ink-2); font-size: 14.5px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.topbar-actions .ctl { height: 40px; width: auto; min-width: 118px; font-size: 15px; }
.topbar-actions form { display: flex; gap: 10px; margin: 0; }

.content { padding: 26px 32px 60px; max-width: 1320px; }

/* ---------- STAT CARDS ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(212px, 1fr));
  gap: 16px; margin-bottom: 26px;
}

.stat {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.stat-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 10px;
}
.stat-label { font-size: 15px; color: var(--ink-2); }

.badge {
  width: 42px; height: 42px; flex: 0 0 42px;
  border-radius: 11px; display: grid; place-items: center;
}
.badge svg { width: 21px; height: 21px; }
.badge.g { background: var(--green-50);  color: var(--green-700); }
.badge.r { background: var(--red-50);    color: var(--red); }
.badge.b { background: var(--brass-50);  color: #9A7327; }
.badge.n { background: var(--blue-50);   color: var(--blue); }

.stat-value { font-size: 28px; font-weight: 600; letter-spacing: -.02em; line-height: 1.35; }
.stat-value.g { color: var(--green-700); }
.stat-value.r { color: var(--red); }
.stat-value.neg { color: var(--red); }
.stat-sub { font-size: 13.5px; color: var(--ink-3); margin-top: 2px; }

/* ---------- PANELS ---------- */

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  margin-bottom: 22px;
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line-2);
}
.panel-head h3 {
  font-family: var(--nastaliq); margin: 0;
  font-size: 17.5px; line-height: 2.1; font-weight: 600; padding-block: .08em;
}
.panel-head .note { font-size: 14px; color: var(--ink-3); }

/* ہر جدول کے اوپر ایک سطری ہدایت */
.panel-hint {
  margin: 0;
  padding: 10px 22px;
  font-size: 14px; line-height: 1.85;
  color: var(--ink-2);
  background: #FBF9F4;
  border-bottom: 1px solid var(--line-2);
}
.panel-hint b { color: var(--ink); font-weight: 600; }

.filters { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; padding: 18px 22px; }
.filters label { display: block; font-size: 14px; color: var(--ink-2); margin-bottom: 6px; }
.filters .ctl { width: auto; min-width: 152px; }
.filters .btn { margin-bottom: 0; }

/* ---------- TABLE ---------- */

.table-wrap { overflow-x: auto; }

table.data { width: 100%; border-collapse: collapse; font-size: 15.5px; }

table.data th {
  text-align: right; padding: 11px 22px;
  font-weight: 600; font-size: 14px; color: var(--ink-2);
  background: #FBF9F4;
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}
table.data th.num { text-align: left; }
table.data td { padding: 12px 22px; border-bottom: 1px solid var(--line-2); }
table.data td.num { text-align: left; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: #FCFBF7; }

table.data tfoot td {
  font-weight: 700; background: #FBF9F4;
  border-top: 1px solid var(--line); border-bottom: 0;
}

.tag {
  display: inline-block; font-size: 13.5px; line-height: 1.9;
  padding: 1px 11px; border-radius: 20px;
  background: var(--green-50); color: var(--green-700);
}

.empty { padding: 46px 22px; text-align: center; color: var(--ink-2); font-size: 15px; }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; font-size: 16px; }

.bar-track { height: 6px; background: var(--line-2); border-radius: 4px; overflow: hidden; min-width: 80px; }
.bar-fill  { height: 100%; background: var(--green-600); border-radius: 4px; }

.pager {
  display: flex; gap: 16px; align-items: center; justify-content: center;
  font-size: 15px; color: var(--ink-2); padding: 4px 0 12px;
}

/* ---------- MOBILE ---------- */

/* ============================================================ MOBILE */

.menu-btn {
  display: none;
  align-items: center; justify-content: center;
  width: 42px; height: 42px; flex: 0 0 42px;
  background: var(--white); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-s);
  cursor: pointer; padding: 0;
}
.menu-btn svg { width: 20px; height: 20px; }

.scrim {
  display: none; position: fixed; inset: 0; z-index: 40;
  background: rgba(6,35,27,.5);
}
.scrim.show { display: block; }

@media (max-width: 940px) {

  .shell { grid-template-columns: 1fr; }

  /* سائیڈ بار اب دائیں سے کھلنے والا دراز */
  .sidebar {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: 272px; max-width: 84vw;
    z-index: 50; height: 100dvh;
    transform: translateX(100%);
    transition: transform .22s ease;
    box-shadow: -12px 0 32px -18px rgba(0,0,0,.6);
  }
  .sidebar.open { transform: translateX(0); }
  @media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

  .main { grid-column: 1; grid-row: 1; }

  .menu-btn { display: inline-flex; }

  .topbar {
    padding: 10px 14px; gap: 10px;
    position: sticky; top: 0;
    flex-wrap: nowrap; align-items: center;
  }
  .topbar h1 { font-size: 19px; flex: 1 1 auto; min-width: 0; }
  .topbar .meta { display: none; }          /* شمار نیچے کارڈ میں دکھتا ہے */

  .topbar-actions {
    gap: 8px; flex-wrap: nowrap;
    overflow-x: auto; scrollbar-width: none;
  }
  .topbar-actions::-webkit-scrollbar { display: none; }
  .topbar-actions .btn { height: 38px; padding: 0 14px; font-size: 14.5px; }
  .topbar-actions .ctl { height: 38px; min-width: 104px; font-size: 14.5px; }

  .content { padding: 16px 14px 60px; }

  /* شمار مہیا کرنے والی سطر */
  .meta-strip {
    display: block; margin: 0 0 14px;
    padding: 11px 15px; font-size: 14.5px;
    background: var(--white); color: var(--ink-2);
    border: 1px solid var(--line); border-radius: var(--r-s);
  }

  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 14px 15px; border-radius: var(--r-s); }
  .stat-top { margin-bottom: 6px; gap: 8px; }
  .stat-label { font-size: 13.5px; }
  .stat-value { font-size: 21px; }
  .stat-sub { font-size: 12.5px; }
  .badge { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 9px; }
  .badge svg { width: 17px; height: 17px; }

  .panel { border-radius: var(--r-s); margin-bottom: 16px; }
  .panel-head { padding: 12px 15px; }
  .panel-head h3 { font-size: 16px; }
  .panel-hint { padding: 9px 15px; font-size: 13.5px; }

  .filters { padding: 14px 15px; gap: 10px; }
  .filters > div { flex: 1 1 150px; }
  .filters .ctl, .filters input { width: 100%; min-width: 0; }
  .filters .btn { flex: 1 1 130px; }

  table.data { font-size: 14.5px; }
  table.data th, table.data td { padding: 10px 12px; }
  table.data th { font-size: 13px; }

  .sb-brand { padding: 0 18px 16px; }
  .nav { padding: 4px 0 10px; }
  .nav-group { padding: 12px 18px 4px; }
  .nav a, .nav .off { padding: 11px 18px; }
  .sb-foot { padding: 14px 18px 0; }
}

@media (min-width: 941px) {
  .meta-strip { display: none; }
}

/* ============================================================ MODAL */

.modal-scrim {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(6,35,27,.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 5vh 16px; overflow-y: auto;
}
.modal-scrim[hidden] { display: none; }

.modal {
  background: var(--white);
  border-radius: var(--r);
  width: 100%; max-width: 680px;
  box-shadow: 0 30px 70px -24px rgba(0,0,0,.55);
  overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-bottom: 1px solid var(--line-2); background: var(--paper-2);
}
.modal-head h3 {
  font-family: var(--nastaliq); font-size: 18px; line-height: 2.1;
  margin: 0; font-weight: 600; padding-block: .08em;
}
.modal-x {
  background: none; border: 0; font-size: 26px; line-height: 1;
  color: var(--ink-2); cursor: pointer; padding: 0 4px;
}
.modal-body { padding: 20px 22px; }
.modal-foot {
  display: flex; gap: 12px; flex-wrap: wrap;
  padding: 16px 22px; border-top: 1px solid var(--line-2); background: #FBF9F4;
}

.month-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px;
}
.month-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; font-size: 15px;
  border: 1px solid var(--line); border-radius: var(--r-s);
  cursor: pointer; background: var(--white);
}
.month-pill:has(input:checked) {
  border-color: var(--green-600); background: var(--green-50);
}
.month-pill input { width: 17px; height: 17px; flex: 0 0 17px; }

@media (max-width: 620px) {
  .modal-scrim { padding: 0; }
  .modal { max-width: none; border-radius: 0; min-height: 100dvh; }
  .month-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* ============================================================ PRINT (A4) */

@page { size: A4; margin: 14mm 12mm; }

@media print {
  body { background: #fff; font-size: 12pt; }
  .sidebar, .topbar, .scrim, .menu-btn, .no-print, .pager { display: none !important; }
  .shell { display: block; }
  .main  { display: block; }
  .content { padding: 0; max-width: none; }

  .panel { border: 0; box-shadow: none; border-radius: 0; margin: 0 0 10mm; }
  .panel-head { border-bottom: 1px solid #999; padding: 0 0 4mm; }
  .panel-hint { display: none; }

  table.data { font-size: 10.5pt; }
  table.data th { background: #EFEADE !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.data th, table.data td { padding: 2mm 3mm; border-bottom: 1px solid #CCC; }
  table.data tfoot td { background: #EFEADE !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.data tbody tr { break-inside: avoid; }
  thead { display: table-header-group; }

  a { color: #000; text-decoration: none; }
}

/* ============================================================ REPORT SHEET */

.sheet {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 26px 30px;
  max-width: 900px;
  box-shadow: var(--shadow-sm);
}
.sheet-head { text-align: center; border-bottom: 2px solid var(--green-800); padding-bottom: 16px; margin-bottom: 6px; }
.sheet-head h2 {
  font-family: var(--nastaliq); font-size: 26px; line-height: 2.3;
  margin: 0; padding-block: .1em; font-weight: 700;
}
.sheet-head p { margin: 4px 0 0; font-size: 15px; color: var(--ink-2); }
.sheet-meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px 20px; margin: 18px 0 22px; font-size: 14.5px;
}
.sheet-meta div { border-bottom: 1px dotted var(--line); padding-bottom: 5px; }
.sheet-meta span { color: var(--ink-3); }
/* حساب کا کلیہ — جدول کے اوپر */
.formula {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 0 0 16px; padding: 12px 16px;
  background: var(--brass-50);
  border: 1px solid rgba(190,146,67,.42);
  border-radius: var(--r-s);
  font-size: 14.5px; line-height: 1.9; color: #6E5220;
}
.formula code {
  font-family: var(--naskh); font-size: 15px; font-weight: 600;
  color: var(--green-800); background: var(--white);
  border: 1px solid var(--line); border-radius: 4px;
  padding: 3px 12px; white-space: nowrap; direction: rtl;
}
.formula span { flex: 1 1 260px; min-width: 0; }

@media print {
  .formula {
    background: #F5F1E6 !important; border-color: #BBB;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
    font-size: 10pt; margin-bottom: 5mm;
  }
  .formula code { background: #fff !important; }
}

@media (max-width: 940px) {
  .formula { padding: 11px 13px; font-size: 13.5px; gap: 10px; }
  .formula code { font-size: 14px; }
}

.sheet-sign {
  display: flex; justify-content: space-between; gap: 40px;
  margin-top: 40px; font-size: 14.5px; color: var(--ink-2);
}
.sheet-sign div { border-top: 1px solid var(--ink-3); padding-top: 6px; min-width: 170px; text-align: center; }

@media print {
  .sheet { border: 0; box-shadow: none; padding: 0; max-width: none; border-radius: 0; }
}

@media (max-width: 940px) {
  .sheet { padding: 18px 15px; border-radius: var(--r-s); }
  .sheet-head h2 { font-size: 20px; }
  /* حساب کا کلیہ — جدول کے اوپر */
.formula {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 0 0 16px; padding: 12px 16px;
  background: var(--brass-50);
  border: 1px solid rgba(190,146,67,.42);
  border-radius: var(--r-s);
  font-size: 14.5px; line-height: 1.9; color: #6E5220;
}
.formula code {
  font-family: var(--naskh); font-size: 15px; font-weight: 600;
  color: var(--green-800); background: var(--white);
  border: 1px solid var(--line); border-radius: 4px;
  padding: 3px 12px; white-space: nowrap; direction: rtl;
}
.formula span { flex: 1 1 260px; min-width: 0; }

@media print {
  .formula {
    background: #F5F1E6 !important; border-color: #BBB;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
    font-size: 10pt; margin-bottom: 5mm;
  }
  .formula code { background: #fff !important; }
}

@media (max-width: 940px) {
  .formula { padding: 11px 13px; font-size: 13.5px; gap: 10px; }
  .formula code { font-size: 14px; }
}

.sheet-sign { flex-direction: column; gap: 26px; }
}