:root {
  --primary: #14532d;
  --primary-2: #0f766e;
  --primary-3: #166534;
  --accent: #f59e0b;
  --accent-2: #0e7490;
  --pink: #c026d3;
  --rose: #e11d48;
  --violet: #7c3aed;
  --blue: #2563eb;
  --sky: #0284c7;
  --lime: #65a30d;
  --orange: #ea580c;
  --danger: #b42318;
  --warning: #b54708;
  --success: #067647;
  --info: #175cd3;
  --ink: #101828;
  --ink-soft: #344054;
  --muted: #667085;
  --line: #d9e2dc;
  --line-strong: #bdcabe;
  --page: #f3f7f4;
  --surface: #ffffff;
  --surface-2: #f9fcfa;
  --surface-3: #eef6f1;
  --field: #fbfdfc;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-md: 0 10px 28px rgba(16, 24, 40, .09);
  --shadow-lg: 0 20px 55px rgba(16, 24, 40, .14);
  --radius: 8px;
  --radius-sm: 6px;
  --sidebar-width: 292px;
  --focus: 0 0 0 4px rgba(15, 118, 110, .14);
  --rainbow: linear-gradient(90deg, #14532d, #0f766e, #0284c7, #7c3aed, #c026d3, #ea580c, #f59e0b);
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  font-size: 16px;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Montserrat, Arial, sans-serif;
  letter-spacing: 0;
  background:
    radial-gradient(circle at 9% 8%, rgba(192, 38, 211, .12), transparent 26%),
    radial-gradient(circle at 86% 12%, rgba(2, 132, 199, .13), transparent 28%),
    radial-gradient(circle at 70% 86%, rgba(245, 158, 11, .11), transparent 30%),
    linear-gradient(180deg, rgba(238, 246, 241, .94) 0, rgba(243, 247, 244, .99) 260px),
    var(--page);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(20, 83, 45, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 83, 45, .025) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, #000, transparent 68%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; }

h1,
h2,
h3,
.brand,
.nav,
.primary-btn,
.ghost-btn,
.icon-btn {
  font-family: Poppins, Arial, sans-serif;
}

h1 {
  margin: 0;
  font-size: clamp(1.35rem, 1.1rem + .7vw, 1.95rem);
  line-height: 1.18;
  color: #0b2f1b;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 14px;
  font-size: 1.02rem;
  line-height: 1.25;
  color: #163322;
}

p { line-height: 1.65; }

.urdu {
  font-family: "JameelNooriNastaliq", "Jameel Noori Nastaleeq", "Noto Nastaliq Urdu", serif;
  font-size: 1.09em;
  line-height: 1.85;
  letter-spacing: 0;
}

.app-shell {
  position: relative;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: min(var(--sidebar-width), 86vw);
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, #ffffff 0, #fbfffd 42%, #f2f8ff 72%, #fff7ed 100%);
  border-right: 1px solid rgba(20, 83, 45, .14);
  box-shadow: 16px 0 45px rgba(16, 24, 40, .13);
  transform: translateX(-104%);
  transition: transform .22s ease;
}

.sidebar-open .sidebar { transform: translateX(0); }

.sidebar-open::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(2px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 78px;
  padding: 16px;
  border-bottom: 1px solid rgba(20, 83, 45, .12);
  background:
    linear-gradient(90deg, rgba(20, 83, 45, .08), rgba(14, 116, 144, .08), rgba(245, 158, 11, .08));
}

.brand strong {
  display: block;
  font-size: 1.03rem;
  color: #102a1a;
}

.brand span,
.top-title span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: .82rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.brand-mark {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 10px 24px rgba(15, 118, 110, .26);
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 5px;
}

.brand-mark.large {
  width: 62px;
  height: 62px;
  margin: auto;
  font-size: 1.55rem;
}

.nav {
  display: grid;
  gap: 4px;
  padding: 12px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(20, 83, 45, .28) transparent;
}

.nav a {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px 11px 10px 14px;
  border-radius: var(--radius-sm);
  color: #23352b;
  text-decoration: none;
  font-size: .91rem;
  font-weight: 650;
  transition: background-color .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.nav a::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b5c7bc;
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  opacity: .72;
}

.nav a:nth-child(7n+1)::before { background: var(--primary-2); }
.nav a:nth-child(7n+2)::before { background: var(--blue); }
.nav a:nth-child(7n+3)::before { background: var(--accent); }
.nav a:nth-child(7n+4)::before { background: var(--violet); }
.nav a:nth-child(7n+5)::before { background: var(--rose); }
.nav a:nth-child(7n+6)::before { background: var(--orange); }
.nav a:nth-child(7n+7)::before { background: var(--lime); }

.nav a:hover {
  color: #0b3b25;
  background: linear-gradient(90deg, rgba(220, 252, 231, .95), rgba(224, 242, 254, .85));
  box-shadow: inset 0 0 0 1px rgba(20, 83, 45, .08);
  transform: translateX(2px);
}

.nav a:hover::before { background: var(--primary-2); }

.nav .urdu {
  color: #6b756f;
  font-size: .94rem;
  line-height: 1.3;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 16px;
  border-top: 1px solid rgba(20, 83, 45, .12);
  color: #52645a;
  font-size: .76rem;
  line-height: 1.55;
  background: rgba(255, 255, 255, .54);
}

.main {
  min-width: 0;
  position: relative;
  z-index: 1;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, .82);
  background-image: linear-gradient(90deg, rgba(20, 83, 45, .08), rgba(2, 132, 199, .08), rgba(192, 38, 211, .06), rgba(245, 158, 11, .08));
  border-bottom: 1px solid rgba(20, 83, 45, .14);
  box-shadow: 0 10px 28px rgba(16, 24, 40, .045);
  backdrop-filter: blur(14px);
}

.top-title {
  min-width: 0;
  flex: 1;
}

.top-title strong {
  display: block;
  color: #102a1a;
  line-height: 1.25;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-user {
  display: none;
  min-width: 0;
  max-width: 180px;
  padding: 7px 10px;
  border: 1px solid rgba(20, 83, 45, .12);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(240, 253, 244, .9), rgba(239, 246, 255, .92));
  box-shadow: var(--shadow-sm);
}

.top-user strong,
.top-user span {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.top-user strong {
  color: #0f3d25;
  font-size: .82rem;
  line-height: 1.2;
}

.top-user span {
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.25;
}

.content {
  width: min(100%, 1420px);
  margin: 0 auto;
  padding: 16px;
}

.page-head {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin: 4px 0 18px;
  padding: 17px;
  overflow: hidden;
  border: 1px solid rgba(20, 83, 45, .12);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(220, 252, 231, .95), rgba(224, 242, 254, .92) 48%, rgba(253, 244, 255, .88)),
    #fff;
  box-shadow: var(--shadow-md);
}

.page-head::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: var(--rainbow);
}

.page-head > * {
  position: relative;
  z-index: 1;
}

.page-head p {
  margin: 5px 0 0;
  color: var(--muted);
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.primary-btn,
.ghost-btn,
.icon-btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 750;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .16s ease, box-shadow .16s ease, background-color .16s ease, border-color .16s ease;
}

.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, var(--primary) 0, var(--primary-2) 38%, var(--blue) 100%);
  box-shadow: 0 12px 26px rgba(37, 99, 235, .22);
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(15, 118, 110, .28);
}

.ghost-btn,
.icon-btn {
  color: #21332a;
  background: linear-gradient(180deg, #fff, #f7fbff);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}

.ghost-btn:hover,
.icon-btn:hover {
  background: linear-gradient(135deg, #f0fdf4, #eff6ff);
  border-color: #b7c8bd;
  transform: translateY(-1px);
}

.icon-btn {
  width: 44px;
  padding: 0;
  font-size: 1.18rem;
}

.menu-btn {
  display: inline-grid;
  place-items: center;
  gap: 4px;
}

.menu-btn span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: #1f3529;
}

.primary-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--primary);
  font-weight: 750;
  text-decoration: none;
}

.primary-link:hover { text-decoration: underline; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.metric-card,
.panel,
.table-wrap,
.print-page {
  background: rgba(255, 255, 255, .96);
  border: 1px solid rgba(20, 83, 45, .12);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.metric-card {
  position: relative;
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  overflow: hidden;
  padding: 15px;
  color: #fff;
  border: 0;
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  background: linear-gradient(135deg, #14532d, #0f766e);
  z-index: 0;
}

.metric-card::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 14px;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .25), rgba(255, 255, 255, .08));
}

.metric-card:nth-child(8n+1)::before { background: linear-gradient(135deg, #14532d, #0f766e); }
.metric-card:nth-child(8n+2)::before { background: linear-gradient(135deg, #0e7490, #2563eb); }
.metric-card:nth-child(8n+3)::before { background: linear-gradient(135deg, #b7791f, #ea580c); }
.metric-card:nth-child(8n+4)::before { background: linear-gradient(135deg, #7c3aed, #c026d3); }
.metric-card:nth-child(8n+5)::before { background: linear-gradient(135deg, #be123c, #e11d48); }
.metric-card:nth-child(8n+6)::before { background: linear-gradient(135deg, #047857, #65a30d); }
.metric-card:nth-child(8n+7)::before { background: linear-gradient(135deg, #1d4ed8, #0284c7); }
.metric-card:nth-child(8n+8)::before { background: linear-gradient(135deg, #9333ea, #db2777); }

.metric-card span {
  max-width: calc(100% - 46px);
  color: rgba(255, 255, 255, .86);
  font-size: .78rem;
  font-weight: 700;
  line-height: 1.42;
  text-transform: uppercase;
}

.metric-card strong {
  position: relative;
  z-index: 1;
  color: #fff;
  font-family: Poppins, Arial, sans-serif;
  font-size: clamp(1.35rem, 1.06rem + .9vw, 2.1rem);
  line-height: 1;
}

.split-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 14px;
}

.panel {
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.panel::before,
.table-wrap::before {
  content: "";
  display: block;
  height: 4px;
  margin: -16px -16px 14px;
  background: var(--rainbow);
}

.split-grid .panel:nth-child(6n+1)::before { background: linear-gradient(90deg, var(--primary-2), var(--blue)); }
.split-grid .panel:nth-child(6n+2)::before { background: linear-gradient(90deg, var(--orange), var(--accent)); }
.split-grid .panel:nth-child(6n+3)::before { background: linear-gradient(90deg, var(--violet), var(--pink)); }
.split-grid .panel:nth-child(6n+4)::before { background: linear-gradient(90deg, var(--rose), var(--orange)); }
.split-grid .panel:nth-child(6n+5)::before { background: linear-gradient(90deg, var(--success), var(--lime)); }
.split-grid .panel:nth-child(6n+6)::before { background: linear-gradient(90deg, var(--blue), var(--sky)); }

.panel h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(20, 83, 45, .09);
}

.mini-list {
  display: grid;
  gap: 9px;
}

.mini-list div,
.mini-list a {
  display: block;
  padding: 11px 12px;
  border: 1px solid rgba(20, 83, 45, .1);
  border-radius: var(--radius-sm);
  color: var(--ink);
  text-decoration: none;
  background: linear-gradient(135deg, #fff, #f8fbff);
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.mini-list div:nth-child(5n+1),
.mini-list a:nth-child(5n+1) { border-left: 4px solid var(--primary-2); }
.mini-list div:nth-child(5n+2),
.mini-list a:nth-child(5n+2) { border-left: 4px solid var(--blue); }
.mini-list div:nth-child(5n+3),
.mini-list a:nth-child(5n+3) { border-left: 4px solid var(--accent); }
.mini-list div:nth-child(5n+4),
.mini-list a:nth-child(5n+4) { border-left: 4px solid var(--pink); }
.mini-list div:nth-child(5n+5),
.mini-list a:nth-child(5n+5) { border-left: 4px solid var(--lime); }

.mini-list div:hover,
.mini-list a:hover {
  border-color: #b8cabe;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.mini-list strong {
  color: #143721;
  font-weight: 800;
}

.mini-list span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.5;
}

.filter-bar,
.inline-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  padding: 11px;
  border: 1px solid rgba(20, 83, 45, .1);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .95), rgba(240, 253, 250, .82)),
    #fff;
  box-shadow: var(--shadow-sm);
}

.inline-form {
  margin-bottom: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.filter-bar::before {
  content: "Filters";
  align-self: center;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary-2), var(--blue));
  font-family: Poppins, Arial, sans-serif;
  font-size: .74rem;
  font-weight: 850;
}

.filter-bar input,
.filter-bar select,
.inline-form input {
  flex: 1;
  min-width: 150px;
}

.stack-form {
  display: grid;
  gap: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.form-grid label,
.stack-form > label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #26382f;
  font-size: .86rem;
  font-weight: 750;
}

.form-grid label.wide { grid-column: 1 / -1; }

.form-grid em {
  color: var(--muted);
  font-style: normal;
  font-weight: 500;
}

input,
select,
textarea {
  width: 100%;
  min-height: 45px;
  padding: 10px 12px;
  border: 1px solid #c8d6ce;
  border-radius: var(--radius-sm);
  outline: none;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255,255,255,.95), rgba(248,250,252,.95));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72);
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

textarea {
  min-height: 108px;
  resize: vertical;
}

select {
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, #667085 50%),
    linear-gradient(135deg, #667085 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 19px,
    calc(100% - 13px) 19px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
  appearance: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .13), inset 0 0 0 1px rgba(15, 118, 110, .12);
}

input:disabled {
  color: #76847d;
  background: #eef3ef;
}

.sensitive {
  display: flex;
  align-items: stretch;
}

.sensitive input {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.sensitive button {
  min-width: 72px;
  border: 1px solid #c8d6ce;
  border-left: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: #234034;
  background: #f4faf6;
  font-weight: 750;
  cursor: pointer;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  position: relative;
}

.table-wrap::before {
  margin: 0;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table th,
.data-table td {
  padding: 13px 12px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid rgba(20, 83, 45, .1);
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #40534a;
  background: linear-gradient(180deg, #eff6ff, #f0fdf4);
  font-family: Poppins, Arial, sans-serif;
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.data-table tbody tr {
  transition: background-color .14s ease, box-shadow .14s ease;
}

.data-table tbody tr:hover {
  background: linear-gradient(90deg, #fbfefc, #f8fbff);
}

.data-table tbody tr:nth-child(6n+1) td:first-child { box-shadow: inset 4px 0 0 var(--primary-2); }
.data-table tbody tr:nth-child(6n+2) td:first-child { box-shadow: inset 4px 0 0 var(--blue); }
.data-table tbody tr:nth-child(6n+3) td:first-child { box-shadow: inset 4px 0 0 var(--accent); }
.data-table tbody tr:nth-child(6n+4) td:first-child { box-shadow: inset 4px 0 0 var(--pink); }
.data-table tbody tr:nth-child(6n+5) td:first-child { box-shadow: inset 4px 0 0 var(--lime); }
.data-table tbody tr:nth-child(6n+6) td:first-child { box-shadow: inset 4px 0 0 var(--rose); }

.data-table td {
  color: #23352b;
  font-size: .9rem;
}

.data-table tr:last-child td { border-bottom: 0; }

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: #1f2937;
  background: linear-gradient(135deg, #eef2ff, #fdf4ff);
  border: 1px solid rgba(102, 112, 133, .16);
  font-size: .76rem;
  font-weight: 850;
}

.badge.paid,
.badge.active,
.badge.approved {
  color: #05603a;
  background: linear-gradient(135deg, #dcfae6, #ecfccb);
  border-color: #abefc6;
}

.badge.partial,
.badge.pending,
.badge.installed {
  color: #93370d;
  background: linear-gradient(135deg, #fef0c7, #ffedd5);
  border-color: #fedf89;
}

.badge.unpaid,
.badge.inactive,
.badge.suspended,
.badge.rejected,
.badge.cancelled {
  color: #912018;
  background: linear-gradient(135deg, #fee4e2, #fce7f3);
  border-color: #fecdca;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 11px;
}

.detail-grid div {
  padding: 12px;
  border: 1px solid rgba(20, 83, 45, .1);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #fff, #f8fbff);
}

.detail-grid div:nth-child(6n+1) { border-top: 3px solid var(--primary-2); }
.detail-grid div:nth-child(6n+2) { border-top: 3px solid var(--blue); }
.detail-grid div:nth-child(6n+3) { border-top: 3px solid var(--accent); }
.detail-grid div:nth-child(6n+4) { border-top: 3px solid var(--pink); }
.detail-grid div:nth-child(6n+5) { border-top: 3px solid var(--lime); }
.detail-grid div:nth-child(6n+6) { border-top: 3px solid var(--rose); }

.detail-grid span {
  display: block;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-grid strong {
  display: block;
  margin-top: 5px;
  color: #183522;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.muted {
  color: var(--muted);
  font-size: .84rem;
}

.flash {
  position: relative;
  margin-bottom: 12px;
  padding: 13px 14px 13px 44px;
  border: 1px solid rgba(20, 83, 45, .12);
  border-radius: var(--radius);
  color: #26382f;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.flash::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  transform: translateY(-50%);
  background: var(--info);
}

.flash.success,
.flash.info {
  color: #07543a;
  background: #ecfdf3;
  border-color: #abefc6;
}

.flash.success::before,
.flash.info::before { background: var(--success); }

.flash.error {
  color: #912018;
  background: #fffbfa;
  border-color: #fecdca;
}

.flash.error::before { background: var(--danger); }

.bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 132px) minmax(80px, 1fr) 42px;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}

.bar-row span {
  min-width: 0;
  overflow: hidden;
  color: #273a31;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.bar-row b {
  display: block;
  min-width: 8px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary-2), var(--accent-2));
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .08);
}

.bar-row em {
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
  text-align: right;
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
  background:
    radial-gradient(circle at 18% 18%, rgba(192, 38, 211, .18), transparent 28%),
    radial-gradient(circle at 82% 18%, rgba(37, 99, 235, .18), transparent 30%),
    radial-gradient(circle at 50% 90%, rgba(245, 158, 11, .16), transparent 32%),
    linear-gradient(135deg, rgba(20, 83, 45, .12), transparent 46%),
    linear-gradient(225deg, rgba(14, 116, 144, .14), transparent 48%),
    #f5f8f6;
}

.auth-card {
  width: min(430px, 100%);
  padding: 24px;
  border: 1px solid rgba(20, 83, 45, .13);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow-lg);
  border-top: 5px solid transparent;
  border-image: var(--rainbow) 1;
}

.auth-brand {
  margin-bottom: 20px;
  text-align: center;
}

.auth-brand h1 {
  margin-top: 12px;
}

.auth-brand p {
  margin: 4px 0 0;
  color: var(--muted);
}

.auth-footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(20, 83, 45, .1);
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.6;
  text-align: center;
}

.print-page {
  max-width: 840px;
  margin: auto;
  padding: 26px;
}

.print-page header {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.print-page header h1 {
  color: var(--primary);
}

.print-page footer {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.6;
  text-align: center;
}

body.urdu-mode {
  direction: rtl;
}

body.urdu-mode .data-table th,
body.urdu-mode .data-table td,
body.urdu-mode .page-head,
body.urdu-mode .detail-grid div {
  text-align: right;
}

body.urdu-mode select {
  background-position: 18px 19px, 13px 19px;
  padding-left: 34px;
  padding-right: 12px;
}

body.urdu-mode .sidebar {
  inset: 0 0 0 auto;
  border-left: 1px solid rgba(20, 83, 45, .14);
  border-right: 0;
  transform: translateX(104%);
}

body.urdu-mode.sidebar-open .sidebar { transform: translateX(0); }

body.urdu-mode .nav a::before {
  left: auto;
  right: 4px;
}

@media (min-width: 760px) {
  .sidebar {
    transform: none;
    box-shadow: none;
  }

  .main { margin-left: var(--sidebar-width); }

  body.urdu-mode .main {
    margin-right: var(--sidebar-width);
    margin-left: 0;
  }

  body.urdu-mode .sidebar { transform: none; }

  .icon-btn { display: none; }

  .top-user { display: block; }

  .content { padding: 24px; }

  .metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  .split-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .detail-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .detail-grid.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .content { padding: 28px; }
}

@media (max-width: 900px) {
  .top-actions .ghost-btn {
    padding-inline: 11px;
  }
}

@media (max-width: 640px) {
  body::before { background-size: 28px 28px; }

  .topbar {
    min-height: 62px;
    padding: 9px 10px;
  }

  .top-actions form { display: none; }

  .top-title span { display: none; }

  .content { padding: 12px; }

  .page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .page-head .primary-btn,
  .page-head .ghost-btn,
  .page-head .row-actions {
    width: 100%;
  }

  .row-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .primary-btn,
  .ghost-btn {
    width: 100%;
  }

  .filter-bar,
  .inline-form {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .filter-bar::before {
    width: max-content;
  }

  .filter-bar input,
  .filter-bar select,
  .filter-bar button,
  .inline-form input,
  .inline-form button {
    width: 100%;
    min-width: 0;
  }

  .metric-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .metric-card {
    min-height: 105px;
    padding: 13px;
  }

  .metric-card span {
    font-size: .72rem;
  }

  .panel {
    padding: 14px;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .data-table thead { display: none; }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table tr {
    margin-bottom: 11px;
    overflow: hidden;
    border: 1px solid rgba(20, 83, 45, .13);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-md);
  }

  .data-table tr:nth-child(6n+1) { border-top: 4px solid var(--primary-2); }
  .data-table tr:nth-child(6n+2) { border-top: 4px solid var(--blue); }
  .data-table tr:nth-child(6n+3) { border-top: 4px solid var(--accent); }
  .data-table tr:nth-child(6n+4) { border-top: 4px solid var(--pink); }
  .data-table tr:nth-child(6n+5) { border-top: 4px solid var(--lime); }
  .data-table tr:nth-child(6n+6) { border-top: 4px solid var(--rose); }

  .data-table td {
    display: grid;
    grid-template-columns: minmax(92px, 42%) minmax(0, 1fr);
    gap: 10px;
    min-height: 44px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(20, 83, 45, .08);
  }

  .data-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: .74rem;
    font-weight: 850;
    text-transform: uppercase;
  }

  .actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
  }

  .actions::before { display: none; }

  .actions a,
  .data-table td[data-label="Action"] a {
    min-height: 38px;
    display: inline-grid;
    place-items: center;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--primary);
    background: #f8fcfa;
    font-weight: 800;
    text-decoration: none;
  }

  .detail-grid,
  .detail-grid.compact {
    grid-template-columns: 1fr;
  }

  .bar-row {
    grid-template-columns: minmax(84px, 110px) minmax(70px, 1fr) 34px;
  }

  .auth-card {
    padding: 18px;
  }

  .print-page {
    padding: 16px;
  }
}

@media (max-width: 380px) {
  .metric-grid { grid-template-columns: 1fr; }

  .data-table td {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .row-actions {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: #fff;
  }

  body::before,
  .sidebar,
  .topbar,
  .print-hide,
  .flash {
    display: none !important;
  }

  .app-shell { display: block; }

  .main {
    margin: 0 !important;
  }

  .content {
    width: 100%;
    padding: 0;
  }

  .print-page,
  .panel,
  .table-wrap {
    border: 0;
    box-shadow: none;
  }

  .data-table th,
  .data-table td {
    border: 1px solid #bbb;
  }
}
