:root {
  --primary: #0f4c81;
  --primary-dark: #0a3559;
  --primary-light: #e8f1f8;
  --accent: #1a73e8;
  --success: #0d9488;
  --warning: #d97706;
  --danger: #dc2626;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
img {
  max-width: 100%;
  height: auto;
}
.login-logo img,
.logo img {
  height: 40px !important;
  width: auto !important;
  max-width: 140px !important;
  max-height: 40px !important;
  object-fit: contain;
}
.login-logo img {
  height: 56px;
  max-width: 180px;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== LOGIN ===== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a3559 0%, #0f4c81 50%, #1a73e8 100%);
  padding: 1.5rem;
}

.login-card {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.login-logo .logo-mark {
  background: var(--primary);
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-logo strong {
  display: block;
  font-size: 1.05rem;
}

.login-logo span {
  font-size: 0.75rem;
  color: var(--gray-500);
}

/* Auth Tabs */
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--gray-200);
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 0.7rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}

.auth-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.auth-tab:hover {
  color: var(--primary);
}

.login-sub {
  color: var(--gray-500);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.login-error {
  background: #fef2f2;
  color: var(--danger);
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.login-success {
  background: #ecfdf5;
  color: #047857;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.btn-full {
  width: 100%;
  margin-top: 0.5rem;
}

.demo-accounts {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--gray-200);
  font-size: 0.8rem;
  color: var(--gray-700);
}

.demo-accounts ul {
  list-style: none;
  margin-top: 0.5rem;
}

.demo-accounts li {
  margin-bottom: 0.35rem;
}

.demo-accounts code {
  background: var(--gray-100);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.78rem;
}

/* Header */
.header {
  background: var(--primary);
  color: white;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.45rem 1rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem 1rem;
}
.header-inner .logo {
  grid-column: 1;
  min-width: 0;
}
.header-inner .nav {
  grid-column: 2;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.header-inner .user-area {
  grid-column: 3;
  justify-self: end;
  margin-left: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-mark {
  background: white;
  color: var(--primary);
  font-weight: 700;
  font-size: 1.1rem;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.logo-text strong {
  font-size: 1.05rem;
}

.logo-text span {
  font-size: 0.75rem;
  opacity: 0.85;
}

.nav {
  display: flex;
  gap: 0.5rem;
}

.nav-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,.3);
  color: white;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.nav-btn:hover,
.nav-btn.active {
  background: white;
  color: var(--primary);
  border-color: white;
}

.user-area {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 0.8rem;
  line-height: 1.25;
  white-space: nowrap;
}
.user-area .btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  white-space: nowrap;
}

.role-badge {
  font-size: 0.7rem;
  background: rgba(255,255,255,.2);
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Main */
.main {
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.subtitle {
  color: var(--gray-500);
  font-size: 0.9rem;
  margin-top: 0.15rem;
}

.toolbar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.toolbar input[type="search"],
.toolbar select {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.875rem;
  background: white;
  min-width: 160px;
}

/* Export / Import dropdown */
.export-dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-arrow {
  font-size: 0.65rem;
  margin-left: 0.25rem;
  opacity: 0.9;
}

.export-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 160px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  overflow: hidden;
}

.export-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.65rem 1rem;
  border: none;
  background: white;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--gray-900);
  cursor: pointer;
}

.export-menu-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.export-menu-item + .export-menu-item {
  border-top: 1px solid var(--gray-100);
}

/* Multi status filter (dashboard) */
.status-filter-wrap {
  position: relative;
  display: inline-block;
}
.status-filter-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 220px;
  max-height: 320px;
  overflow-y: auto;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 60;
  padding: 0.75rem;
}
.status-filter-panel label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  padding: 0.25rem 0;
  cursor: pointer;
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}

.stat-card .label {
  font-size: 0.75rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-card .value {
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 0.15rem;
}

/* Table */
.table-wrap {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: auto; /* both horizontal + vertical */
  max-height: min(70vh, 640px);
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--gray-200);
}
.table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.table-wrap::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 6px;
}
.table-wrap::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.data-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.data-table th {
  background: var(--gray-100);
  text-align: left;
  padding: 0.45rem 0.55rem;
  font-weight: 600;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.data-table td {
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
  font-size: 0.8rem;
}

.data-table tr:hover td {
  background: var(--primary-light);
}

.data-table .actions {
  display: flex;
  gap: 0.35rem;
}

.btn-icon {
  background: none;
  border: 1px solid var(--gray-300);
  border-radius: 5px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--gray-700);
}

.btn-icon:hover {
  background: var(--gray-100);
}

.btn-icon.danger:hover {
  background: #fef2f2;
  border-color: var(--danger);
  color: var(--danger);
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-draft { background: #f3f4f6; color: #4b5563; }
.badge-submitted { background: #dbeafe; color: #1d4ed8; }
.badge-under-review { background: #fef3c7; color: #b45309; }
.badge-approved { background: #d1fae5; color: #047857; }
.badge-rejected { background: #fee2e2; color: #b91c1c; }
.badge-disbursed { background: #ccfbf1; color: #0f766e; }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-500);
}

.empty-state.hidden { display: none; }

/* Form */
.loan-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-section {
  background: white;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}

.form-section legend {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary);
  padding: 0 0.35rem;
}

.optional {
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--gray-500);
}

.sub-heading {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 1rem 0 0.6rem;
  color: var(--gray-700);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1.25rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem 1.25rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-700);
}

.field input,
.field select,
.field textarea {
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color 0.15s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

.field input:disabled {
  background: var(--gray-100);
  color: var(--gray-700);
  cursor: not-allowed;
}

.field-hint {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}

.mt-1 { margin-top: 1rem; }

/* Income source rows */
.income-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr auto;
  gap: 0.6rem;
  align-items: end;
  margin-bottom: 0.6rem;
  padding: 0.6rem;
  background: var(--gray-50);
  border-radius: 6px;
}

.income-row .field {
  margin: 0;
}

/* Documents */
.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.5rem;
}

.doc-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  padding: 0.4rem 0.5rem;
  border-radius: 5px;
  cursor: pointer;
}

.doc-item:hover {
  background: var(--gray-100);
}

.doc-item input {
  accent-color: var(--primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1.15rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-ghost {
  background: white;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
}

.btn-ghost:hover {
  background: var(--gray-100);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 0 2rem;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
}

.modal-header h2 {
  font-size: 1.15rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--gray-500);
  padding: 0 0.25rem;
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  font-size: 0.9rem;
}

.modal-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.4rem 1rem;
}

.detail-grid dt {
  color: var(--gray-500);
  font-size: 0.8rem;
}

.detail-grid dd {
  font-weight: 500;
  margin: 0;
}

.detail-section {
  margin-bottom: 1.25rem;
}

.detail-section h3 {
  font-size: 0.95rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--gray-200);
}

/* Footer */
.footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.75rem;
  color: var(--gray-500);
  border-top: 1px solid var(--gray-200);
  background: white;
}

/* Responsive */
@media (max-width: 900px) {
  .grid-3 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

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

  .header-inner {
    flex-wrap: wrap;
  }

  .header-inner .user-area {
    margin-left: auto;
    width: auto;
  }

  .data-table {
    font-size: 0.8rem;
  }

  .data-table th,
  .data-table td {
    padding: 0.5rem 0.6rem;
  }
}

.hidden {
  display: none !important;
}


/* ===== Dashboard overview cards & chart ===== */
.dashboard-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-700);
  margin: 1.25rem 0 0.75rem;
}
.dashboard-section-title .hint {
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--gray-500);
}

.stats-summary {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 0.25rem;
}

.stats-statuses {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.stat-card.clickable {
  cursor: pointer;
  user-select: none;
}
.stat-card.clickable:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-left-color: var(--accent);
}
.stat-card.clickable:active {
  transform: translateY(0);
}
.stat-card.active-filter {
  outline: 2px solid var(--accent);
  background: var(--primary-light);
}
.stat-card {
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.stat-card.stat-zero .value {
  color: var(--gray-300);
}
.stat-card.stat-total {
  border-left-color: #0f4c81;
  background: linear-gradient(135deg, #f0f7fc 0%, #fff 100%);
}
.stat-card.stat-revenue {
  border-left-color: #0d9488;
}
.stat-card.stat-paid {
  border-left-color: #d97706;
}

.dashboard-chart-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  margin-top: 1.25rem;
  margin-bottom: 1rem;
}
.chart-wrap {
  position: relative;
  width: 100%;
  max-height: 280px;
  height: 260px;
}
.chart-empty {
  text-align: center;
  color: var(--gray-500);
  font-size: 0.9rem;
  padding: 2rem 1rem;
}

.list-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.list-toolbar input[type="search"] {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.875rem;
  background: white;
  min-width: 180px;
  flex: 1;
  max-width: 280px;
}

.stat-card[data-status="Draft"] { border-left-color: #6b7280; }
.stat-card[data-status="Under Review"] { border-left-color: #d97706; }
.stat-card[data-status="Submitted"] { border-left-color: #2563eb; }
.stat-card[data-status="Login Query"] { border-left-color: #ea580c; }
.stat-card[data-status="Sent For Login"] { border-left-color: #7c3aed; }
.stat-card[data-status="Login"] { border-left-color: #4f46e5; }
.stat-card[data-status="Legal + Technical Query"] { border-left-color: #c026d3; }
.stat-card[data-status="Sanctioned/Approved"] { border-left-color: #059669; }
.stat-card[data-status="Rejected"] { border-left-color: #dc2626; }
.stat-card[data-status="Disbursement Query"] { border-left-color: #b45309; }
.stat-card[data-status="Sent for Disbursement"] { border-left-color: #0891b2; }
.stat-card[data-status="Disbursed with OTC/PDD"] { border-left-color: #0d9488; }
.stat-card[data-status="Handover with PDD"] { border-left-color: #0f766e; }
.stat-card[data-status="Handover Partial"] { border-left-color: #14746f; }
.stat-card[data-status="Handover Full"] { border-left-color: #065f46; }


/* ===== Manage Users: denser table ===== */
#view-users .table-wrap {
  max-width: 100%;
}
#view-users .data-table {
  min-width: 900px;
  font-size: 0.78rem;
}
#view-users .data-table th,
#view-users .data-table td {
  padding: 0.35rem 0.45rem;
}
#view-users .data-table td code {
  font-size: 0.75rem;
}
#view-users .data-table .actions {
  flex-wrap: nowrap;
  gap: 0.25rem;
}
#view-users .data-table .actions .btn-icon {
  padding: 0.15rem 0.4rem;
  font-size: 0.7rem;
}
#view-users .badge {
  font-size: 0.65rem;
  padding: 0.12rem 0.4rem;
}

/* Header stays one row on desktop; stack only on very small screens */
@media (max-width: 900px) {
  .header-inner {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
  }
  .header-inner .logo { grid-column: 1; grid-row: 1; }
  .header-inner .user-area { grid-column: 2; grid-row: 1; justify-self: end; }
  .header-inner .nav { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
}

.header .btn-ghost {
  background: transparent;
  border-color: rgba(255,255,255,.45);
  color: #fff;
}
.header .btn-ghost:hover {
  background: rgba(255,255,255,.15);
  color: #fff;
  border-color: #fff;
}


/* ===== Manage Users table: fit all columns ===== */
#view-users .main,
#view-users {
  max-width: none;
}
#view-users .table-wrap {
  overflow-x: auto !important;
  overflow-y: visible;
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--gray-200);
}
#view-users .data-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
  font-size: 0.75rem;
}
#view-users .data-table th {
  padding: 0.35rem 0.4rem !important;
  font-size: 0.68rem !important;
}
#view-users .data-table td {
  padding: 0.3rem 0.4rem !important;
  font-size: 0.75rem !important;
  white-space: nowrap;
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
#view-users .data-table td.cell-name {
  max-width: 8rem;
  font-weight: 500;
}
#view-users .data-table td.cell-rights {
  max-width: 5.5rem;
}
#view-users .data-table td.actions {
  max-width: none;
  white-space: nowrap;
  position: sticky;
  right: 0;
  background: #fff;
  box-shadow: -4px 0 8px rgba(0,0,0,.04);
  z-index: 1;
}
#view-users .data-table thead th:last-child {
  position: sticky;
  right: 0;
  background: var(--gray-100);
  z-index: 2;
}
#view-users .data-table .actions {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 0.2rem;
}
#view-users .data-table .actions .btn-icon {
  padding: 0.12rem 0.35rem;
  font-size: 0.68rem;
  line-height: 1.2;
}
#view-users .badge {
  font-size: 0.62rem;
  padding: 0.1rem 0.35rem;
}
#view-users .cell-clip {
  display: inline-block;
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
#view-users .muted { color: #94a3b8; }
#view-users code { font-size: 0.72rem; }

/* Dashboard/main still capped; users view uses full width */
#app-shell:has(#view-users.active) .main {
  max-width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
}


/* ===== Scrollable panels (overflow → both axes) ===== */
#view-users .table-wrap {
  max-height: min(65vh, 560px);
  overflow: auto;
}
#view-dashboard .table-wrap {
  max-height: min(65vh, 560px);
  overflow: auto;
}
.modal-body {
  overflow: auto;
  max-height: min(70vh, 520px);
}
.item-list {
  overflow: auto;
}
.status-filter-panel {
  overflow: auto;
}
.export-menu {
  overflow: auto;
  max-height: 280px;
}
/* Sticky table header while scrolling vertically */
.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--gray-100);
  box-shadow: 0 1px 0 var(--gray-200);
}
