:root {
  /* Default: LIGHT MODE */
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --surface-2: #F1F5F9;
  --surface-3: #E2E8F0;
  --border: #CBD5E1;
  --text: #0F172A;
  --text-dim: #64748B;
  --amber: #D97706;
  --green: #059669;
  --danger: #DC2626;
  --primary: #2563EB;
  --topbar-bg: rgba(255, 255, 255, 0.96);
  --btn-text: #FFFFFF;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --font-ur: 'Noto Nastaliq Urdu', serif;
}

[data-theme="dark"] {
  /* DARK MODE (Original Colors) */
  --bg: #0F1C22;
  --surface: #16262D;
  --surface-2: #1E323A;
  --surface-3: #263e48;
  --border: #2B4048;
  --text: #EDEAE0;
  --text-dim: #8FA3A8;
  --amber: #E8A33D;
  --green: #e8f6f1;
  --danger: #C1524B;
  --primary: #3B82F6;
  --topbar-bg: rgba(15, 28, 34, 0.96);
  --btn-text: #1a1207;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}


body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  -webkit-tap-highlight-color: transparent;
  line-height: 1.45;
}

.ur {
  font-family: var(--font-ur);
  font-weight: 600;
}

::selection {
  background: var(--amber);
  color: #0F1C22;
}

a {
  color: inherit;
  text-decoration: none;
}

/* APP SHELL */
.app {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* SIDEBAR (Desktop Fixed Sticky) */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  height: 100vh;
  max-height: 100vh;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 240px;
  z-index: 50;
  box-sizing: border-box;
}

body.lang-ur .sidebar {
  left: auto;
  right: 0;
  border-right: none;
  border-left: 1px solid var(--border);
}


.nav-scroll {
  overflow-y: auto;
  flex: 1;
  margin-right: -6px;
  padding-right: 6px;
  -webkit-overflow-scrolling: touch;
}

.nav-scroll::-webkit-scrollbar {
  width: 5px;
}

.nav-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 18px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(160deg, var(--amber), #c97f22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: #1a1207;
  font-size: 15px;
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.25;
}

.brand-name span {
  display: block;
  font-family: var(--font-ur);
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
  margin-top: 1px;
}

.sidebar-close-btn {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

.nav-group-label {
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 14px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 7px;
  cursor: pointer;
  color: var(--text-dim);
  font-weight: 500;
  margin-bottom: 1px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.nav-item .ic {
  width: 18px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
}

.nav-item .en {
  flex: 1;
  font-size: 12.8px;
}

.nav-item .ur {
  font-size: 12.5px;
  color: var(--text-dim);
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-item.active {
  background: var(--surface-2);
  color: var(--amber);
}

.nav-item.active .ur {
  color: var(--amber);
  opacity: .85;
}

.nav-item.locked {
  opacity: .35;
  cursor: not-allowed;
}

.nav-sub {
  padding-left: 30px;
  font-size: 12.5px;
  color: var(--text-dim);
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* TOPBAR */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  margin-left: 240px;
  width: calc(100% - 240px);
  min-height: 100vh;
}

body.lang-ur .main {
  margin-left: 0;
  margin-right: 240px;
}

.topbar {
  height: 64px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--topbar-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 40;
  gap: 12px;
}


.menu-toggle {
  display: none;
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-title .title-en {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-title .ur {
  font-size: 13.5px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.company-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  max-width: 240px;
}

.company-badge-pill .company-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.company-badge-pill .company-code-tag {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  flex-shrink: 0;
}

.topbar-select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  font-family: var(--font-body);
  font-size: 12px;
  max-width: 220px;
  outline: none;
  cursor: pointer;
}

.topbar-select:focus {
  border-color: var(--amber);
}

.lang-switch {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.lang-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.lang-btn.active {
  background: var(--amber);
  color: var(--btn-text);
}

.logout-btn {
  padding: 6px 12px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: var(--btn-text);
  flex-shrink: 0;
}

body.lang-en .ur {
  display: none !important;
}

body.lang-ur .en {
  display: none !important;
}

body.lang-ur {
  direction: rtl;
}

body.lang-ur .nav-item,
body.lang-ur .kpi .lbl,
body.lang-ur .gauge-legend div {
  flex-direction: row-reverse;
}

/* CONTENT & HEADERS */
.content {
  padding: 24px;
  min-width: 0;
  width: 100%;
}

.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-head h1 {
  font-family: var(--font-display);
  font-size: 21px;
  margin: 0;
  font-weight: 600;
  line-height: 1.25;
}

.page-head .sub {
  color: var(--text-dim);
  font-size: 12.5px;
  margin-top: 3px;
}

/* BUTTONS */
.btn {
  background: var(--amber);
  color: var(--btn-text);
  border: none;
  border-radius: 7px;
  padding: 9px 16px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-body);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.15s ease;
  min-height: 38px;
  box-sizing: border-box;
}

.btn:hover {
  filter: brightness(1.08);
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn.ghost:hover {
  background: var(--surface-2);
  border-color: var(--text-dim);
}

/* KPI CARDS */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  transition: border-color 0.2s;
}

.kpi:hover {
  border-color: rgba(232, 163, 61, 0.4);
}

.kpi .lbl {
  font-size: 11.5px;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kpi .lbl .ur {
  font-size: 11px;
}

.kpi .val {
  font-family: var(--font-display);
  font-size: 24px;
  margin-top: 8px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.kpi .val small {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
}

.kpi .delta {
  font-size: 11px;
  margin-top: 6px;
  color: var(--green);
}

.kpi .delta.down {
  color: var(--danger);
}

/* PANELS & TABLES */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 20px;
}

.panel::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar {
  height: 6px;
}

.panel::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.panel-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.panel-head h2 {
  font-family: var(--font-display);
  font-size: 14.5px;
  margin: 0;
  font-weight: 600;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-dim);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  white-space: nowrap;
}

td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--surface-2);
}

.num {
  font-family: var(--font-mono);
  text-align: right;
}

.pos {
  color: var(--green);
}

.neg {
  color: var(--danger);
}

.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.tag.paid {
  background: rgba(78, 156, 130, .15);
  color: var(--green);
}

.tag.pending {
  background: rgba(232, 163, 61, .15);
  color: var(--amber);
}

.tag.overdue {
  background: rgba(193, 82, 75, .15);
  color: var(--danger);
}

/* TABLE ACTIONS & BUTTONS */
.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.row-action,
.btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.16s ease;
  line-height: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  box-sizing: border-box;
}

.row-action svg,
.btn-action svg,
.row-action span,
.btn-action span {
  pointer-events: none;
}

.row-action[data-action="edit"],
.btn-action.edit {
  color: var(--amber);
  border-color: rgba(232, 163, 61, 0.3);
  background: rgba(232, 163, 61, 0.08);
}

.row-action[data-action="edit"]:hover,
.btn-action.edit:hover {
  background: rgba(232, 163, 61, 0.22);
  border-color: var(--amber);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(232, 163, 61, 0.25);
  color: #fff;
}

.row-action[data-action="delete"],
.btn-action.delete {
  color: var(--danger);
  border-color: rgba(193, 82, 75, 0.3);
  background: rgba(193, 82, 75, 0.08);
}

.row-action[data-action="delete"]:hover,
.btn-action.delete:hover {
  background: rgba(193, 82, 75, 0.22);
  border-color: var(--danger);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(193, 82, 75, 0.25);
  color: #fff;
}

/* VEHICLE PLATE BADGE */
.plate-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(30, 50, 58, 0.9), rgba(22, 38, 45, 0.95));
  border: 1px solid rgba(232, 163, 61, 0.35);
  border-radius: 6px;
  padding: 4px 9px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.plate-badge .plate-reg {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--amber);
}

.plate-badge .plate-sub {
  font-size: 10.5px;
  color: var(--text-dim);
  border-left: 1px solid var(--border);
  padding-left: 6px;
  margin-left: 2px;
}

/* BILINGUAL OWNER CELL */
.owner-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.owner-cell .owner-name-en {
  font-weight: 500;
  color: var(--text);
  line-height: 1.25;
}

.owner-cell .owner-name-ur {
  font-family: var(--font-ur);
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.35;
}

/* CAPACITY CELL */
.capacity-cell {
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 4px;
}

.capacity-cell .capacity-num {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.capacity-cell .capacity-unit {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* PERCENTAGE BADGES */
.pct-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.pct-badge.comm {
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.25);
  background: rgba(96, 165, 250, 0.08);
}

.pct-badge.tax {
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.25);
  background: rgba(245, 158, 11, 0.08);
}

/* COMPLIANCE EXPIRY BADGES */
.compliance-stack {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 140px;
}

.compliance-chip {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  line-height: 1.35;
  border: 1px solid transparent;
  width: fit-content;
}

.compliance-chip .comp-label {
  color: var(--text-dim);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.compliance-chip .comp-val {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10.5px;
}

.compliance-chip.compliance-valid {
  background: rgba(78, 156, 130, 0.12);
  border-color: rgba(78, 156, 130, 0.28);
  color: #6ee7b7;
}

.compliance-chip.compliance-warning {
  background: rgba(232, 163, 61, 0.15);
  border-color: rgba(232, 163, 61, 0.38);
  color: #fcd34d;
}

.compliance-chip.compliance-expired {
  background: rgba(193, 82, 75, 0.18);
  border-color: rgba(193, 82, 75, 0.45);
  color: #fca5a5;
  font-weight: 700;
}

/* CUSTOM PAGINATION */
.custom-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 4px 4px;
}

.pagination-info {
  font-size: 12.5px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 5px;
}

.pagination-info .highlight {
  color: var(--amber);
  font-weight: 600;
  font-family: var(--font-mono);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: all 0.15s ease;
  user-select: none;
}

.page-link:hover:not(.disabled):not(.active):not(.dots) {
  color: var(--text);
  border-color: var(--amber);
  background: rgba(232, 163, 61, 0.12);
  transform: translateY(-1px);
}

.page-link.active {
  background: var(--amber);
  color: #1a1207;
  border-color: var(--amber);
  font-weight: 700;
}

.page-link.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.page-link.dots {
  background: transparent;
  border-color: transparent;
  cursor: default;
}

/* FILTER BAR */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 18px;
}

.filter-bar .search-box {
  flex: 1;
  min-width: 220px;
}

.filter-bar input,
.filter-bar select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 12.5px;
  outline: none;
  height: 36px;
  box-sizing: border-box;
}

.filter-bar input:focus,
.filter-bar select:focus {
  border-color: var(--amber);
}

/* TWO COLUMN FORM + LIST LAYOUT */
.grid-2 {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  align-items: start;
}

.form-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
}

.form-panel h2 {
  font-family: var(--font-display);
  font-size: 14.5px;
  margin: 0 0 14px;
  font-weight: 600;
}

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 11.5px;
  color: var(--text-dim);
  margin-bottom: 5px;
}

.field input,
.field select,
.field textarea,
select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  min-height: 38px;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.2s;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
select:focus {
  border-color: var(--amber);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* TABS */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border-radius: 8px;
  padding: 4px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 16px;
}

.tab {
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
  border: none;
  background: none;
}

.tab.active {
  background: var(--amber);
  color: #1a1207;
}

.empty-hint {
  padding: 30px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12.5px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-2);
  border: 1px solid var(--amber);
  color: var(--text);
  padding: 11px 20px;
  border-radius: 9px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: .25s;
  z-index: 1050;
  max-width: 90vw;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* MODALS */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 28, 34, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 16px;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 650px;
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
  margin-bottom: 18px;
}

/* FILTER BARS & SEARCH */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  background: var(--surface);
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.filter-bar input,
.filter-bar select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 7px 12px;
  color: var(--text);
  border-radius: 6px;
  font-size: 13px;
}

/* REPORT KPI CARDS */
.report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

/* =========================================================
   RESPONSIVE DESIGN BREAKPOINTS
   Laptops (<= 1200px) | Tablets (<= 992px) | Mobiles (<= 640px) | XS (<= 380px)
   ========================================================= */

/* 1. TABLET & MOBILE DRAWER (<= 992px) */
@media (max-width: 992px) {
  .app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }

  .main {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
  }


  /* Off-canvas Navigation Drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
    overflow-y: auto;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.85);
  }

  body.lang-ur .sidebar {
    left: auto;
    right: 0;
    transform: translateX(100%);
  }

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

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 28, 34, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
  }

  .sidebar-backdrop.show {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: 6px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
    transition: all 0.15s;
  }

  .sidebar-close-btn:hover {
    color: var(--amber);
    border-color: var(--amber);
  }

  /* Hamburger Menu Toggle Button */
  .menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 38px;
    height: 38px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
  }

  .menu-toggle .bar {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--text);
    border-radius: 2px;
    transition: background 0.2s;
  }

  .menu-toggle:hover,
  .menu-toggle:active {
    background: var(--surface-2);
    border-color: var(--amber);
  }

  .menu-toggle:hover .bar {
    background: var(--amber);
  }

  /* Two column form becomes single column on tablets */
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 20px 18px;
  }

  .topbar {
    padding: 0 18px;
    height: 60px;
  }

  .kpi-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

/* 2. MOBILE LANDSCAPE & TABLETS PORTRAIT (<= 768px) */
@media (max-width: 768px) {
  .topbar {
    padding: 0 14px;
    height: 58px;
  }

  .topbar-title {
    font-size: 15px;
  }

  .topbar-select {
    max-width: 150px;
    font-size: 11.5px;
  }

  .company-badge-pill {
    max-width: 160px;
    font-size: 11.5px;
    padding: 4px 8px;
  }

  .content {
    padding: 16px 14px;
  }

  .page-head {
    margin-bottom: 16px;
  }

  .page-head h1 {
    font-size: 19px;
  }

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

/* 3. MOBILE PHONES (<= 640px) */
@media (max-width: 640px) {
  .hide-mobile {
    display: none !important;
  }

  .topbar {
    height: 56px;
    padding: 0 10px;
    gap: 8px;
  }

  .topbar-right {
    gap: 6px;
  }

  .topbar-title {
    font-size: 14px;
    max-width: 130px;
  }

  .company-badge-pill {
    max-width: 120px;
    font-size: 11px;
    padding: 3px 6px;
  }

  .topbar-select {
    max-width: 125px;
    font-size: 11px;
    padding: 4px 6px;
  }

  .lang-btn {
    padding: 4px 7px;
    font-size: 10.5px;
  }

  .avatar {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }

  .logout-btn {
    padding: 6px 8px;
    font-size: 11.5px;
  }

  .content {
    padding: 12px 10px;
  }

  .kpi-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
  }

  .kpi {
    padding: 12px 14px;
  }

  .kpi .val {
    font-size: 20px;
    margin-top: 6px;
  }

  .kpi .lbl {
    font-size: 11px;
  }

  .panel {
    border-radius: 10px;
    margin-bottom: 16px;
  }

  .panel-head {
    padding: 12px 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  th,
  td {
    padding: 9px 12px;
  }

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

  .page-head h1 {
    font-size: 18px;
  }

  .page-head .btn {
    width: 100%;
    justify-content: center;
  }

  body:not(.lang-ur) .topbar-title .title-ur {
    display: none;
  }

  .modal-box {
    padding: 16px 14px;
    border-radius: 10px;
    width: 95vw;
  }

  .modal-head h3 {
    font-size: 15px;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .filter-bar input,
  .filter-bar select,
  .filter-bar button {
    width: 100%;
  }

  .report-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}

/* 4. EXTRA SMALL PHONES (<= 380px) */
@media (max-width: 380px) {
  .report-kpi-grid {
    grid-template-columns: 1fr;
  }

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

  .topbar-title {
    max-width: 95px;
  }

  .topbar-right {
    gap: 4px;
  }

  .company-badge-pill {
    max-width: 90px;
  }

  .topbar-select {
    max-width: 95px;
  }

  .page-head h1 {
    font-size: 16px;
  }
}