/* =====================================================================
   Inspection Manager – Stylesheet
   Refined, professional, industrial utility aesthetic
   Font: DM Sans (display) + IBM Plex Mono (accents)
===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  /* Brand palette: #003e6b navy · #5aa5d4 blue · #febd86 amber · #ffffff white */
  --im-bg:        #f0f5f9;
  --im-surface:   #ffffff;
  --im-border:    #c8dde9;
  --im-border-2:  #9bbfd4;
  --im-text:      #003e6b;
  --im-text-2:    #2d6a91;
  --im-text-3:    #6698b3;
  --im-accent:    #003e6b;
  --im-accent-d:  #002d4e;
  --im-accent-bg: #e6f0f7;
  --im-highlight: #febd86;
  --im-highlight-d: #f9a55a;
  --im-highlight-bg: #fff4e8;
  --im-link:      #5aa5d4;
  --im-success:   #0d9a5b;
  --im-warning:   #d97706;
  --im-danger:    #dc2626;
  --im-radius:    10px;
  --im-radius-sm: 6px;
  --im-shadow:    0 1px 4px rgba(0,62,107,.08), 0 4px 16px rgba(0,62,107,.06);
  --im-shadow-md: 0 4px 24px rgba(0,62,107,.14);
  --im-font:      'DM Sans', system-ui, sans-serif;
  --im-mono:      'IBM Plex Mono', monospace;
  --im-transition: .18s cubic-bezier(.4,0,.2,1);
}

/* Base */
.im-wrap * { box-sizing: border-box; }
.im-wrap {
  font-family: var(--im-font);
  color: var(--im-text);
  line-height: 1.6;
  background: var(--im-bg);
  min-height: 100vh;
  padding: 32px 24px;
  max-width: 1100px;
  margin: 0 auto;
}

/* ── Notices ── */
.im-notice {
  padding: 14px 18px;
  border-radius: var(--im-radius-sm);
  margin-bottom: 20px;
  font-size: 15px;
}
.im-notice--warning { background: #fef9c3; color: #854d0e; border: 1px solid #fde68a; }

/* ── Alert ── */
.im-alert {
  border-radius: var(--im-radius-sm);
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
}
.im-alert--success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.im-alert--error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Form Header ── */
.im-form-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}
.im-form-header__icon {
  width: 48px; height: 48px;
  background: var(--im-accent-bg);
  border-radius: var(--im-radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.im-form-header__icon svg { width: 24px; height: 24px; color: var(--im-accent); }
.im-form-header__title { margin: 0; font-size: 22px; font-weight: 700; color: var(--im-text); }
.im-form-header__sub   { margin: 2px 0 0; font-size: 14px; color: var(--im-text-2); }

/* ── Tabs ── */
.im-tabs {
  display: flex;
  border-bottom: 2px solid var(--im-border);
  margin-bottom: 24px;
  gap: 4px;
}
.im-tab {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  border: none; background: none;
  font-family: var(--im-font); font-size: 14px; font-weight: 500;
  color: var(--im-text-2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  border-radius: var(--im-radius-sm) var(--im-radius-sm) 0 0;
  transition: color var(--im-transition), border-color var(--im-transition), background var(--im-transition);
}
.im-tab svg { width: 16px; height: 16px; }
.im-tab:hover { color: var(--im-accent); background: var(--im-accent-bg); }
.im-tab--active {
  color: var(--im-accent);
  border-bottom-color: var(--im-accent);
  background: var(--im-accent-bg);
}

/* ── Tab Panels ── */
.im-tab-panel { display: none; }
.im-tab-panel--active { display: block; }

/* ── Unread message badge on tab ── */
.im-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #dc2626;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}
.im-tab-badge[hidden] { display: none; }

/* ── Sections ── */
.im-section {
  background: var(--im-surface);
  border: 1px solid var(--im-border);
  border-radius: var(--im-radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--im-shadow);
}
.im-section__title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--im-text-3);
  margin-bottom: 18px;
  font-family: var(--im-mono);
}
.im-section--status { border-left: 3px solid var(--im-accent); }

/* ── Grid ── */
.im-grid { display: grid; gap: 16px; }
.im-grid--2 { grid-template-columns: repeat(2, 1fr); }
.im-grid--3 { grid-template-columns: repeat(3, 1fr); }
.im-field--full { grid-column: 1 / -1; }
@media (max-width: 640px) {
  .im-grid--2, .im-grid--3 { grid-template-columns: 1fr; }
}

/* ── Fields ── */
.im-field { display: flex; flex-direction: column; gap: 6px; }
.im-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--im-text);
}
.im-label .req { color: var(--im-danger); }

.im-input, .im-select, .im-textarea {
  width: 100%;
  padding: 0 10px;
  height: 44px;
  border: 1.5px solid var(--im-border);
  border-radius: var(--im-radius-sm);
  font-family: var(--im-font);
  font-size: 14px;
  color: var(--im-text);
  background: var(--im-surface);
  transition: border-color var(--im-transition), box-shadow var(--im-transition);
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
}
.im-textarea {
  height: auto;
  padding: 10px;
  min-height: 100px;
}
.im-input:focus, .im-select:focus, .im-textarea:focus {
  outline: none;
  border-color: var(--im-accent);
  box-shadow: 0 0 0 3px rgba(90,165,212,.2);
}
.im-input::placeholder { color: var(--im-text-3); }

.im-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235a6380' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px;
  padding-right: 36px;
  cursor: pointer;
}

.im-textarea { resize: vertical; min-height: 80px; }

/* ── Checkbox ── */
.im-field--checkbox { justify-content: center; flex-direction: row; align-items: center; gap: 0; }
.im-checkbox-label {
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; font-size: 14px; font-weight: 500;
  user-select: none;
}
.im-checkbox-label input[type="checkbox"] { display: none; }
.im-checkbox-custom {
  width: 20px; height: 20px;
  border: 2px solid var(--im-border-2);
  border-radius: 5px;
  background: var(--im-surface);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--im-transition);
  flex-shrink: 0;
}
.im-checkbox-label input:checked ~ .im-checkbox-custom {
  background: var(--im-accent);
  border-color: var(--im-accent);
}
.im-checkbox-label input:checked ~ .im-checkbox-custom::after {
  content: '';
  width: 10px; height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-2px);
}

/* ── Autocomplete ── */
.im-autocomplete-wrap { position: relative; }
.im-autocomplete-list {
  position: absolute; z-index: 200; top: 100%; left: 0; right: 0;
  width: 100%;
  background: var(--im-surface);
  border: 1.5px solid var(--im-border);
  border-radius: var(--im-radius-sm);
  box-shadow: var(--im-shadow-md);
  list-style: none;
  margin: 0; padding: 4px 0;
  display: none;
  max-height: 240px;
  overflow-y: auto;
}
.im-autocomplete-list.is-open,
.im-autocomplete-list[style*="display: block"],
.im-autocomplete-list[style*="display:block"] { display: block !important; }
.im-autocomplete-list li {
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
  color: var(--im-text);
  transition: background var(--im-transition);
}
.im-autocomplete-list li:hover, .im-autocomplete-list li.active {
  background: var(--im-accent-bg);
  color: var(--im-accent);
}

/* ── Drop Zone ── */
.im-dropzone {
  border: 2px dashed var(--im-border-2);
  border-radius: var(--im-radius);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--im-transition);
  background: var(--im-bg);
}
.im-dropzone svg { width: 40px; height: 40px; color: var(--im-text-3); margin-bottom: 12px; }
.im-dropzone p { margin: 4px 0; font-size: 14px; color: var(--im-text-2); }
.im-dropzone__browse {
  color: var(--im-accent);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}
.im-dropzone__hint { font-size: 12px; color: var(--im-text-3); }
.im-dropzone.dragover, .im-dropzone:hover {
  border-color: var(--im-accent);
  background: var(--im-accent-bg);
}

/* ── File List ── */
.im-file-list { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.im-file-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--im-surface);
  border: 1px solid var(--im-border);
  border-radius: var(--im-radius-sm);
  padding: 10px 14px;
  font-size: 13px;
}
.im-file-item__icon { font-size: 20px; }
.im-file-item__name { flex: 1; color: var(--im-text); font-weight: 500; word-break: break-all; }
.im-file-item__link { color: var(--im-accent); font-size: 12px; }
.im-file-item__remove {
  background: none; border: none;
  cursor: pointer; color: var(--im-text-3);
  padding: 2px 6px; border-radius: 4px;
  transition: color var(--im-transition), background var(--im-transition);
}
.im-file-item__remove:hover { color: var(--im-danger); background: #fee2e2; }

/* ── Form Actions ── */
.im-form-actions {
  display: flex; justify-content: flex-end; gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--im-border);
  margin-top: 8px;
}

/* ── Buttons ── */
.im-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px;
  border-radius: var(--im-radius-sm);
  font-family: var(--im-font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all var(--im-transition);
  text-decoration: none;
  white-space: nowrap;
}
.im-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.im-btn--primary {
  background: var(--im-accent);
  color: #fff;
  border-color: var(--im-accent);
  box-shadow: 0 2px 8px rgba(26,86,219,.24);
}
.im-btn--primary:hover { background: var(--im-accent-d); border-color: var(--im-accent-d); box-shadow: 0 4px 14px rgba(26,86,219,.32); }
.im-btn--primary:disabled { opacity: .6; cursor: not-allowed; }
.im-btn--ghost {
  background: var(--im-surface);
  color: var(--im-text-2);
  border-color: var(--im-border);
}
.im-btn--ghost:hover { border-color: var(--im-border-2); color: var(--im-text); }

/* =====================================================================
   DASHBOARD
===================================================================== */

/* ── Dash Header ── */
.im-dash-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.im-dash-header__title { margin: 0; font-size: 18px; font-weight: 700; }
.im-dash-header__sub   { margin: 2px 0 0; font-size: 12px; color: var(--im-text-2); }

/* ── Stats Grid ── */
.im-stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 6px;
  flex-shrink: 0;
}
@media (max-width: 900px) { .im-stats-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 500px) { .im-stats-grid { grid-template-columns: repeat(2, 1fr); } }

.im-stat-card {
  background: var(--im-surface);
  border: 1px solid var(--im-border);
  border-radius: var(--im-radius);
  padding: 10px 12px;
  text-align: center;
  box-shadow: var(--im-shadow);
  border-top-width: 3px;
}
.im-stat-card--total      { border-top-color: var(--im-accent); }
.im-stat-card--pending    { border-top-color: #f59e0b; }
.im-stat-card--scheduled  { border-top-color: #8b5cf6; }
.im-stat-card--in_progress{ border-top-color: #06b6d4; }
.im-stat-card--completed  { border-top-color: var(--im-success); }
.im-stat-card--failed     { border-top-color: var(--im-danger); }

.im-stat-card__value {
  font-size: 22px; font-weight: 700;
  font-family: var(--im-mono);
  line-height: 1;
  color: var(--im-text);
  margin-bottom: 3px;
}
.im-stat-card__label {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--im-text-3);
  font-family: var(--im-mono);
}

/* ── Filters ── */
.im-dash-filters {
  display: flex; gap: 16px; align-items: center;
  margin-bottom: 14px;
  flex-wrap: nowrap;
  flex-shrink: 0;
  width: 100%;
}
.im-search-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}
.im-search-wrap svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--im-text-3);
  pointer-events: none;
}
.im-dash-search { padding-left: 10px; }
.im-dash-filters .im-filter-select { width: 160px !important; flex-shrink: 0; min-width: 140px; }

/* ── Table ── */
.im-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  line-height: 1.3;
}
.im-table thead tr {
  background: var(--im-bg);
  border-bottom: 2px solid var(--im-border);
}
.im-table th {
  padding: 3px 8px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--im-text-3);
  font-family: var(--im-mono);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.im-table th:hover { color: var(--im-accent); }
.im-table th.sorted-asc::after  { content: ' ↑'; }
.im-table th.sorted-desc::after { content: ' ↓'; }
.im-table td {
  padding: 3px 8px;
  border-bottom: 1px solid var(--im-border);
  vertical-align: middle;
  color: var(--im-text);
}
.im-table tbody tr:last-child td { border-bottom: none; }
.im-table tbody tr:hover { background: var(--im-accent-bg); }
.im-table__loading td { text-align: center; padding: 40px; color: var(--im-text-3); font-size: 14px; }

/* ── Status Badge ── */
.im-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 600;
  font-family: var(--im-mono);
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.im-badge--pending     { background: #fef3c7; color: #92400e; }
.im-badge--scheduled   { background: #ede9fe; color: #5b21b6; }
.im-badge--in_progress { background: #cffafe; color: #155e75; }
.im-badge--completed   { background: #d1fae5; color: #065f46; }
.im-badge--failed      { background: #fee2e2; color: #991b1b; }
.im-badge--cancelled   { background: #f3f4f6; color: #6b7280; }

.im-table-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--im-text-3);
}
.im-table-empty svg { width: 48px; height: 48px; margin-bottom: 12px; display: block; margin-left: auto; margin-right: auto; }
.im-table-empty p { margin: 0; font-size: 15px; }

.im-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--im-text-3);
  background: var(--im-bg);
  border-top: 1px solid var(--im-border);
  font-family: var(--im-mono);
}

/* ── Edit Link ── */
.im-edit-link {
  color: var(--im-accent);
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: var(--im-radius-sm);
  background: var(--im-accent-bg);
  transition: background var(--im-transition);
}
.im-edit-link:hover { background: #dbeafe; }

/* ── Loading spinner ── */
.im-spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2.5px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: im-spin .7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
.im-btn--ghost .im-spinner {
  border-color: rgba(26,31,46,.2);
  border-top-color: var(--im-text-2);
}
@keyframes im-spin { to { transform: rotate(360deg); } }

/* =====================================================================
   PBV 50058 ADDITIONS
===================================================================== */

/* Teal accent for PBV */
:root {
  --im-teal:      #0f766e;
  --im-teal-d:    #0d6460;
  --im-teal-bg:   #f0fdfa;
  --im-teal-border: #99f6e4;
}

.im-wrap--pbv { --im-accent: var(--im-teal); --im-accent-d: var(--im-teal-d); --im-accent-bg: var(--im-teal-bg); }

.im-form-header__icon--teal { background: var(--im-teal-bg); }
.im-form-header__icon--teal svg { color: var(--im-teal); }

.im-btn--teal { background: var(--im-teal) !important; border-color: var(--im-teal) !important; box-shadow: 0 2px 8px rgba(15,118,110,.24) !important; }
.im-btn--teal:hover { background: var(--im-teal-d) !important; border-color: var(--im-teal-d) !important; }

/* Module tabs (dashboard) */
.im-module-tabs {
  flex-shrink: 0;
  display: flex; gap: 4px;
  background: var(--im-surface);
  border: 1px solid var(--im-border);
  border-radius: var(--im-radius);
  padding: 6px;
  margin-bottom: 8px;
  width: fit-content;
}
.im-module-tab {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 20px;
  border: none; background: none;
  font-family: var(--im-font); font-size: 14px; font-weight: 600;
  color: var(--im-text-2); cursor: pointer;
  border-radius: var(--im-radius-sm);
  transition: all var(--im-transition);
}
.im-module-tab svg { width: 16px; height: 16px; }
.im-module-tab:hover { background: var(--im-accent-bg); color: var(--im-accent); }
.im-module-tab--active { background: var(--im-accent); color: #fff; }
.im-module-tab--active:hover { background: var(--im-accent-d); color: #fff; }

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

/* Checklist */
.im-section--checklist { padding: 0; overflow: hidden; }
.im-section--checklist .im-section__title { padding: 16px 24px 0; }

.im-checklist { display: flex; flex-direction: column; }
.im-checklist-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--im-border);
  transition: background var(--im-transition);
}
.im-checklist-row:last-child { border-bottom: none; }
.im-checklist-row:hover { background: var(--im-bg); }
.im-checklist-row.is-yes { background: #f0fdf4; }
.im-checklist-row.is-no  { background: #fef2f2; }
.im-checklist-row.is-na  { background: #f9fafb; }

.im-checklist-label {
  flex: 1;
  font-size: 13.5px;
  color: var(--im-text);
  font-weight: 500;
  line-height: 1.4;
}

.im-checklist-options { display: flex; gap: 6px; flex-shrink: 0; }

.im-radio-label {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--im-border);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--im-mono);
  transition: all var(--im-transition);
  user-select: none;
  white-space: nowrap;
  color: var(--im-text-2);
}
.im-radio-label input[type="radio"] { display: none; }
.im-radio-label:hover { border-color: var(--im-border-2); color: var(--im-text); }

.im-radio-label--yes:has(input:checked),
.im-radio-label--yes.is-checked {
  background: #dcfce7; border-color: #86efac; color: #166534;
}
.im-radio-label--no:has(input:checked),
.im-radio-label--no.is-checked {
  background: #fee2e2; border-color: #fca5a5; color: #991b1b;
}
.im-radio-label--na:has(input:checked),
.im-radio-label--na.is-checked {
  background: #f3f4f6; border-color: #d1d5db; color: #4b5563;
}

/* Checklist progress badge */
.im-checklist-progress {
  background: var(--im-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--im-mono);
  padding: 2px 8px;
  border-radius: 20px;
  margin-left: 4px;
}

/* Checklist summary */
.im-section--checklist-summary { background: var(--im-bg); }
.im-checklist-summary-grid {
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
}
.im-cl-summary-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 16px 24px;
  border-radius: var(--im-radius);
  border: 1px solid var(--im-border);
  background: var(--im-surface);
  min-width: 90px;
  font-size: 12px; font-weight: 600;
  font-family: var(--im-mono); text-transform: uppercase; letter-spacing: .05em;
}
.im-cl-summary-count { font-size: 28px; font-weight: 700; line-height: 1; }
.im-cl-summary-item--yes  { border-top: 3px solid #22c55e; color: #15803d; }
.im-cl-summary-item--no   { border-top: 3px solid #ef4444; color: #dc2626; }
.im-cl-summary-item--na   { border-top: 3px solid #9ca3af; color: #6b7280; }
.im-cl-summary-item--blank{ border-top: 3px solid #f59e0b; color: #d97706; }

/* PBV badge colours */
.im-badge--new            { background: #dbeafe; color: #1e40af; }
.im-badge--pending_review { background: #ede9fe; color: #5b21b6; }
.im-badge--approved       { background: #d1fae5; color: #065f46; }
.im-badge--rejected       { background: #fee2e2; color: #991b1b; }
.im-badge--in_progress    { background: #cffafe; color: #155e75; }

.im-stat-card--pbv-new  { border-top-color: #3b82f6; }
.im-stat-card--open     { border-top-color: #0ea5e9; }
.im-stat-card--resolved { border-top-color: #3b82f6; }
.im-stat-card--today    { border-top-color: #f59e0b; }

/* Ticket tracker badge variants */
.im-badge--open        { background: #e0f2fe; color: #0369a1; }
.im-badge--resolved    { background: #dbeafe; color: #1e40af; }
.im-badge--researching { background: #fef9c3; color: #854d0e; }
.im-badge--callback    { background: #ffedd5; color: #9a3412; }
.im-badge--transfer    { background: #f3e8ff; color: #6b21a8; }

/* Ticket summary table numbers */
.im-num-accent { font-family: var(--im-mono); font-size: 12px; font-weight: 600; color: var(--im-accent); }
.im-num-dim    { font-family: var(--im-mono); font-size: 12px; color: var(--im-text-3); }

/* Readonly fields */
.im-input[readonly] { background: var(--im-bg); color: var(--im-text-2); cursor: default; }

/* =====================================================================
   USER MANAGEMENT
===================================================================== */

/* Role legend */
.im-role-legend {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 20px;
  align-items: center;
}
.im-role-chip {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 12px;
  background: var(--im-surface);
  border: 1px solid var(--im-border);
  border-radius: 30px;
  font-size: 13px;
  box-shadow: var(--im-shadow);
}
.im-role-chip__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--role-color, var(--im-accent));
  flex-shrink: 0;
}
.im-role-chip strong { color: var(--im-text); font-weight: 600; }
.im-role-chip__desc { color: var(--im-text-3); font-size: 11.5px; }
.im-role-chip--note {
  background: transparent;
  border-color: transparent;
  color: var(--im-text-3);
  font-size: 12px; font-weight: 400;
  box-shadow: none;
  padding-left: 4px;
}
.im-role-chip--note svg { width: 13px; height: 13px; opacity: 0.6; }

/* Users table */
.im-users-table .im-role-tags { display: flex; gap: 4px; flex-wrap: wrap; }

/* User table: natural height — NOT a locked dashboard panel */
#admin-tab-users .im-table-wrap .im-table,
#im-users-wrap .im-table-wrap .im-table {
  display: table !important;
  table-layout: auto !important;
}
#admin-tab-users .im-table-wrap .im-table thead,
#im-users-wrap .im-table-wrap .im-table thead {
  display: table-header-group !important;
}
#admin-tab-users .im-table-wrap .im-table tbody,
#im-users-wrap .im-table-wrap .im-table tbody {
  display: table-row-group !important;
  height: auto !important;
  max-height: none !important;
  overflow-y: visible !important;
}
#admin-tab-users .im-table-wrap .im-table thead tr,
#admin-tab-users .im-table-wrap .im-table tbody tr,
#im-users-wrap .im-table-wrap .im-table thead tr,
#im-users-wrap .im-table-wrap .im-table tbody tr {
  display: table-row !important;
}
#admin-tab-users .im-table-wrap,
#im-users-wrap .im-table-wrap { overflow-x: auto; }

/* Positions & Departments — same full-height reset */
#admin-tab-positions .im-table-wrap .im-table,
#admin-tab-departments .im-table-wrap .im-table,
#admin-tab-pbv_action_types .im-table-wrap .im-table,
#admin-tab-properties .im-table-wrap .im-table,
#admin-tab-call_center .im-table-wrap .im-table {
  display: table !important;
  table-layout: auto !important;
}
#admin-tab-positions .im-table-wrap .im-table thead,
#admin-tab-departments .im-table-wrap .im-table thead,
#admin-tab-pbv_action_types .im-table-wrap .im-table thead,
#admin-tab-properties .im-table-wrap .im-table thead,
#admin-tab-call_center .im-table-wrap .im-table thead {
  display: table-header-group !important;
}
#admin-tab-positions .im-table-wrap .im-table tbody,
#admin-tab-departments .im-table-wrap .im-table tbody,
#admin-tab-pbv_action_types .im-table-wrap .im-table tbody,
#admin-tab-properties .im-table-wrap .im-table tbody,
#admin-tab-call_center .im-table-wrap .im-table tbody {
  display: table-row-group !important;
  height: auto !important;
  max-height: none !important;
  overflow-y: visible !important;
}
#admin-tab-positions .im-table-wrap .im-table thead tr,
#admin-tab-positions .im-table-wrap .im-table tbody tr,
#admin-tab-departments .im-table-wrap .im-table thead tr,
#admin-tab-departments .im-table-wrap .im-table tbody tr,
#admin-tab-pbv_action_types .im-table-wrap .im-table thead tr,
#admin-tab-pbv_action_types .im-table-wrap .im-table tbody tr,
#admin-tab-properties .im-table-wrap .im-table thead tr,
#admin-tab-properties .im-table-wrap .im-table tbody tr,
#admin-tab-call_center .im-table-wrap .im-table thead tr,
#admin-tab-call_center .im-table-wrap .im-table tbody tr {
  display: table-row !important;
}
#admin-tab-positions .im-table-wrap,
#admin-tab-departments .im-table-wrap,
#admin-tab-pbv_action_types .im-table-wrap,
#admin-tab-properties .im-table-wrap,
#admin-tab-call_center .im-table-wrap { overflow-x: auto; }

/* Activity Log — same table-layout reset as Users */
#admin-tab-activity_log .im-table-wrap .im-table {
  display: table !important;
  table-layout: auto !important;
}
#admin-tab-activity_log .im-table-wrap .im-table thead {
  display: table-header-group !important;
}
#admin-tab-activity_log .im-table-wrap .im-table tbody {
  display: table-row-group !important;
  height: auto !important;
  max-height: none !important;
  overflow-y: visible !important;
}
#admin-tab-activity_log .im-table-wrap .im-table thead tr,
#admin-tab-activity_log .im-table-wrap .im-table tbody tr {
  display: table-row !important;
}
#admin-tab-activity_log .im-table-wrap { overflow-x: auto; }

/* ── Full-height table reset for all portal lists ────────────────
   Overrides the base scrolling-tbody pattern (display:block; height:200px)
   so every list renders at natural height like the Users table.
   ─────────────────────────────────────────────────────────────── */
#im-dash-table,
#im-pbv-table,
#im-promos-dashboard .im-table-wrap .im-table,
#tk-table {
  display: table !important;
  table-layout: auto !important;
}
#im-dash-table thead,
#im-pbv-table thead,
#im-promos-dashboard .im-table-wrap .im-table thead,
#tk-table thead {
  display: table-header-group !important;
}
#im-dash-table tbody,
#im-pbv-table tbody,
#im-promos-dashboard .im-table-wrap .im-table tbody,
#tk-table tbody {
  display: table-row-group !important;
  height: auto !important;
  max-height: none !important;
  overflow-y: visible !important;
}
#im-dash-table thead tr,
#im-dash-table tbody tr,
#im-pbv-table thead tr,
#im-pbv-table tbody tr,
#im-promos-dashboard .im-table-wrap .im-table thead tr,
#im-promos-dashboard .im-table-wrap .im-table tbody tr,
#tk-table thead tr,
#tk-table tbody tr {
  display: table-row !important;
}
#im-combined-dashboard .im-table-wrap,
#im-promos-dashboard .im-table-wrap,
#module-desk .im-table-wrap {
  overflow-x: auto;
}

/* Pagination controls */
.im-pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}
.im-pagination__btn {
  min-width: 30px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--im-border);
  border-radius: 5px;
  background: var(--im-surface);
  color: var(--im-text-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  font-family: var(--im-font);
}
.im-pagination__btn:hover:not(:disabled) {
  background: var(--im-accent-bg);
  color: var(--im-accent);
  border-color: var(--im-accent);
}
.im-pagination__btn--active {
  background: var(--im-accent) !important;
  color: #fff !important;
  border-color: var(--im-accent) !important;
}
.im-pagination__btn:disabled {
  opacity: .4;
  cursor: default;
}
.im-role-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  font-family: var(--im-mono);
  letter-spacing: .03em;
  background: color-mix(in srgb, var(--role-color) 12%, white);
  color: var(--role-color);
  border: 1px solid color-mix(in srgb, var(--role-color) 30%, white);
}

/* ── Modal ── */
.im-modal-overlay {
  position: fixed; inset: 0; z-index: 99999;
  background: rgba(15, 20, 40, .55);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: im-fade-in .15s ease;
}
@keyframes im-fade-in { from { opacity: 0 } to { opacity: 1 } }

.im-modal {
  background: var(--im-surface);
  border-radius: 14px;
  width: 100%; max-width: 560px;
  box-shadow: 0 20px 60px rgba(0,0,0,.22);
  animation: im-slide-up .2s cubic-bezier(.4,0,.2,1);
  max-height: 90vh;
  display: flex; flex-direction: column;
}
.im-modal--sm { max-width: 400px; }
@keyframes im-slide-up {
  from { opacity: 0; transform: translateY(16px) }
  to   { opacity: 1; transform: translateY(0) }
}

.im-modal__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 0;
}
.im-modal__title { margin: 0; font-size: 18px; font-weight: 700; color: var(--im-text); }
.im-modal__close {
  background: none; border: none;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  cursor: pointer; color: var(--im-text-3);
  transition: all var(--im-transition);
}
.im-modal__close:hover { background: var(--im-bg); color: var(--im-text); }
.im-modal__close svg { width: 18px; height: 18px; }

.im-modal__body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}
.im-modal__footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--im-border);
  background: var(--im-bg);
  border-radius: 0 0 14px 14px;
}

/* Field hint */
.im-field-hint {
  font-size: 12px;
  color: var(--im-text-3);
  margin-top: -2px;
}

/* Password field */
.im-password-wrap { position: relative; }
.im-password-wrap .im-input { padding-right: 42px; }
.im-password-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--im-text-3); padding: 4px;
  display: flex; align-items: center;
  transition: color var(--im-transition);
}
.im-password-toggle:hover { color: var(--im-text); }
.im-password-toggle svg { width: 16px; height: 16px; }

/* Role picker */
.im-role-picker { display: flex; flex-direction: column; gap: 8px; }

.im-role-option { display: block; cursor: pointer; }
.im-role-option input[type="checkbox"] { display: none; }
.im-role-option__box {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border: 2px solid var(--im-border);
  border-radius: var(--im-radius);
  transition: all var(--im-transition);
  background: var(--im-surface);
  user-select: none;
}
.im-role-option:hover .im-role-option__box {
  border-color: var(--role-color);
  background: color-mix(in srgb, var(--role-color) 5%, white);
}
.im-role-option input:checked ~ .im-role-option__box {
  border-color: var(--role-color);
  background: color-mix(in srgb, var(--role-color) 8%, white);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--role-color) 18%, transparent);
}

.im-role-option__check {
  width: 20px; height: 20px; flex-shrink: 0;
  border: 2px solid var(--im-border-2);
  border-radius: 5px;
  background: var(--im-surface);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--im-transition);
}
.im-role-option input:checked ~ .im-role-option__box .im-role-option__check {
  background: var(--role-color);
  border-color: var(--role-color);
}
.im-role-option__check svg { width: 12px; height: 12px; color: #fff; display: none; }
.im-role-option input:checked ~ .im-role-option__box .im-role-option__check svg { display: block; }

.im-role-option__label { font-weight: 600; font-size: 14px; color: var(--im-text); flex: 1; }
.im-role-option__perms { font-size: 12px; color: var(--im-text-3); font-family: var(--im-mono); }

/* Delete confirm */
.im-delete-confirm { text-align: center; padding: 12px 0; }
.im-delete-confirm__icon {
  width: 56px; height: 56px;
  background: #fee2e2;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.im-delete-confirm__icon svg { width: 26px; height: 26px; color: var(--im-danger); }
.im-delete-confirm p { margin: 0 0 8px; font-size: 15px; color: var(--im-text); }
.im-delete-confirm__sub { font-size: 13px; color: var(--im-text-3) !important; }

.im-btn--danger {
  background: var(--im-danger);
  color: #fff;
  border-color: var(--im-danger);
}
.im-btn--danger:hover { background: #b91c1c; border-color: #b91c1c; }

/* Action buttons in table */
.im-table-actions { display: flex; gap: 6px; }
.im-action-btn {
  padding: 4px 12px;
  border-radius: 5px;
  font-size: 12px; font-weight: 600;
  border: 1.5px solid;
  cursor: pointer;
  background: none;
  font-family: var(--im-font);
  transition: all var(--im-transition);
  display: inline-flex; align-items: center; gap: 4px;
  white-space: nowrap;
  text-decoration: none;
}
.im-action-btn svg { width: 13px; height: 13px; }
.im-action-btn--edit  { color: #fff; background: var(--im-accent); border-color: var(--im-accent); }
.im-action-btn--edit:hover { background: #4a90c0; border-color: #4a90c0; }
.im-action-btn--delete { color: var(--im-danger); border-color: var(--im-danger); }
.im-action-btn--delete:hover { background: #fee2e2; }

/* =====================================================================
   NAVIGATION
===================================================================== */
.im-nav {
  background: #003e6b;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1000;
  border-bottom: 1px solid rgba(255,255,255,.07);
  box-shadow: 0 1px 0 rgba(0,0,0,.2), 0 4px 24px rgba(0,0,0,.15);
}

.im-nav__inner {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0 20px;
  height: 58px;
  gap: 0;
  overflow: visible;
  position: relative;
}

/* Brand */
.im-nav__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  margin-right: 12px;
  flex-shrink: 0;
}
.im-nav__brand-icon {
  width: 32px; height: 32px;
  background: var(--im-accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(26,86,219,.35);
}
.im-nav__brand-icon svg { width: 17px; height: 17px; color: #fff; }
.im-nav__brand-icon--logo {
  width: 28px; height: 28px;
  background: #ffffff;
  border-radius: 6px;
  padding: 2px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  overflow: hidden;
}
.im-nav__logo-img {
  width: 100%; height: 100%;
  object-fit: contain;
  border-radius: 4px;
  display: block;
}
.im-nav__brand-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.01em;
}

/* Nav links */
.im-nav__links {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 2px;
  flex-shrink: 1;
  min-width: 0;
}
.im-nav__links li { margin: 0; padding: 0; }

.im-nav__link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 7px;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  color: rgba(255,255,255,.6);
  white-space: nowrap;
  transition: all .15s ease;
  white-space: nowrap;
}
.im-nav__link svg { width: 15px; height: 15px; flex-shrink: 0; opacity: .8; }
.im-nav__link:hover {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.95);
}
.im-nav__link--active {
  background: rgba(254,189,134,.15);
  color: #febd86;
  font-weight: 600;
}
.im-nav__link--active svg { opacity: 1; }

/* User menu */
.im-nav__user { position: relative; margin-left: auto; flex-shrink: 0; padding-left: 24px; }

.im-nav__user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background .15s;
}
.im-nav__user-btn:hover { background: rgba(255,255,255,.08); }

.im-nav__avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--im-accent), #6366f1);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: .02em;
}
.im-nav__avatar--lg { width: 40px; height: 40px; font-size: 15px; }

.im-nav__user-info { text-align: left; }
.im-nav__user-name  { display: block; font-size: 13px; font-weight: 600; color: #fff; line-height: 1.2; }
.im-nav__user-role  { display: block; font-size: 11px; color: rgba(255,255,255,.5); }

.im-nav__chevron { width: 14px; height: 14px; color: rgba(255,255,255,.4); transition: transform .15s; }
.im-nav__user-btn[aria-expanded="true"] .im-nav__chevron { transform: rotate(180deg); }

/* Dropdown */
.im-nav__dropdown {
  position: fixed;
  top: 58px;
  right: 20px;
  background: #1a2035;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  width: 240px;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  display: none;
  overflow: hidden;
  animation: im-fade-in .12s ease;
  z-index: 9999;
}
.im-nav__dropdown.is-open { display: block; }

.im-nav__dropdown-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}
.im-nav__dropdown-name  { font-size: 14px; font-weight: 600; color: #fff; }
.im-nav__dropdown-email { font-size: 12px; color: rgba(255,255,255,.45); margin-top: 2px; word-break: break-all; }

.im-nav__dropdown-divider { height: 1px; background: rgba(255,255,255,.08); }

.im-nav__dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background .12s;
}
.im-nav__dropdown-item svg { width: 15px; height: 15px; flex-shrink: 0; }
.im-nav__dropdown-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.im-nav__dropdown-item--danger { color: #f87171; }
.im-nav__dropdown-item--danger:hover { background: rgba(248,113,113,.12); color: #fca5a5; }

/* Mobile toggle */
.im-nav__mobile-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin-left: auto;
}
.im-nav__mobile-toggle span {
  display: block;
  width: 20px; height: 2px;
  background: rgba(255,255,255,.7);
  border-radius: 2px;
  transition: all .2s;
}

@media (max-width: 768px) {
  /* Two-row mobile nav: brand name centered, hamburger centered below */
  .im-nav {
    height: auto;
  }
  .im-nav__inner {
    flex-direction: column;
    align-items: center;
    height: auto;
    padding: 12px 16px 0;
    gap: 0;
  }

  /* Hide desktop-only elements */
  .im-nav__links    { display: none; }
  .im-nav__user     { display: none; }

  /* Brand: centered, full width */
  .im-nav__brand {
    justify-content: center;
    width: 100%;
    margin: 0 0 8px;
  }

  /* Hamburger: centered below brand */
  .im-nav__mobile-toggle {
    display: flex;
    margin: 0 auto 10px;
    padding: 6px 14px;
    border-radius: 6px;
    background: rgba(255,255,255,.08);
    gap: 5px;
  }
  .im-nav__mobile-toggle span {
    width: 22px;
    height: 2px;
    transition: transform .2s, opacity .2s;
  }
  .im-nav__mobile-toggle.is-open { background: rgba(255,255,255,.12); }
  .im-nav__mobile-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .im-nav__mobile-toggle.is-open span:nth-child(2) { opacity: 0; }
  .im-nav__mobile-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* Dropdown panel */
  .im-nav__links.is-open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: #012a48;
    border-bottom: 1px solid rgba(255,255,255,.08);
    padding: 0;
    gap: 0;
    z-index: 1000;
    box-shadow: 0 12px 32px rgba(0,0,0,.35);
  }

  /* Nav section label */
  .im-nav__links.is-open::before {
    content: 'NAVIGATION';
    display: block;
    padding: 12px 20px 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    color: rgba(255,255,255,.3);
  }

  .im-nav__links.is-open li { width: 100%; }

  /* Each nav link row */
  .im-nav__links.is-open .im-nav__link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 20px;
    color: rgba(255,255,255,.7);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
    position: relative;
  }
  .im-nav__links.is-open .im-nav__link:hover {
    background: rgba(255,255,255,.06);
    color: rgba(255,255,255,.95);
    border-left-color: rgba(255,255,255,.2);
  }
  .im-nav__links.is-open .im-nav__link--active {
    background: rgba(26,86,219,.2);
    color: #fff;
    font-weight: 600;
    border-left-color: #febd86;
  }
  .im-nav__links.is-open .im-nav__link svg {
    width: 18px; height: 18px;
    flex-shrink: 0;
    opacity: .7;
  }
  .im-nav__links.is-open .im-nav__link--active svg,
  .im-nav__links.is-open .im-nav__link:hover svg { opacity: 1; }

  /* Profile card at bottom */
  .im-nav__mobile-user {
    list-style: none;
    background: rgba(0,0,0,.25);
    border-top: 1px solid rgba(255,255,255,.1);
    padding: 16px 20px 20px;
    margin: 8px 0 0;
  }
  .im-nav__mobile-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255,255,255,.08);
  }
  /* Avatar circle */
  .im-nav__mobile-user .im-nav__avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a56db, #0f766e);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
  }
  .im-nav__mobile-user-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
  }
  .im-nav__mobile-user-role {
    font-size: 11px;
    color: rgba(255,255,255,.45);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: .04em;
  }
  .im-nav__mobile-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .im-nav__mobile-action {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255,255,255,.75);
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.07);
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, color .15s;
    width: 100%;
    text-align: left;
    font-family: inherit;
  }
  .im-nav__mobile-action:hover {
    background: rgba(255,255,255,.12);
    color: #fff;
    border-color: rgba(255,255,255,.15);
  }
  .im-nav__mobile-action svg { width: 15px; height: 15px; flex-shrink: 0; opacity: .8; }
  .im-nav__mobile-action--danger {
    color: #fca5a5;
    background: rgba(239,68,68,.08);
    border-color: rgba(239,68,68,.15);
  }
  .im-nav__mobile-action--danger:hover {
    background: rgba(239,68,68,.18);
    color: #fecaca;
    border-color: rgba(239,68,68,.3);
  }
}

/* Mobile user section hidden on desktop */
.im-nav__mobile-user { display: none; }
@media (max-width: 768px) {
  .im-nav__links.is-open .im-nav__mobile-user { display: block; }
}

/* =====================================================================
   FOOTER
===================================================================== */
.im-footer {
  background: #003e6b;
  border-top: 1px solid rgba(255,255,255,.07);
  padding: 14px 24px;
  margin-top: auto;
}
.im-footer__inner {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: rgba(255,255,255,.35);
}
.im-footer__brand { font-weight: 700; color: rgba(255,255,255,.55); letter-spacing: .02em; }
.im-footer__sep   { opacity: .4; }
.im-footer__version { font-family: var(--im-mono); font-size: 11px; color: rgba(255,255,255,.25); }

/* Remove WP admin bar spacing interference */
body.admin-bar .im-nav { top: 32px; }
body.admin-bar /* =====================================================================
   PROPERTIES TABLE ADDITIONS
===================================================================== */
.im-status-badge--active   { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.im-status-badge--inactive { background: #f3f4f6; color: #6b7280; border: 1px solid #e5e7eb; }
.im-status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  font-family: var(--im-mono);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Module tabs on properties page */
#im-properties-wrap .im-module-tabs {
  flex-shrink: 0; margin-bottom: 24px; }

/* =====================================================================
   ADMIN PAGE TABS
===================================================================== */
.im-admin-header { margin-bottom: 20px; }

.im-admin-tabs {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--im-border);
  margin-bottom: 28px;
}

.im-admin-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border: none;
  background: none;
  font-family: var(--im-font);
  font-size: 14px;
  font-weight: 600;
  color: var(--im-text-2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--im-transition);
  white-space: nowrap;
}
.im-admin-tab svg { width: 16px; height: 16px; opacity: .7; }
.im-admin-tab:hover { color: var(--im-text); }
.im-admin-tab--active {
  color: #003e6b;
  border-bottom-color: #febd86;
}
.im-admin-tab--active svg { opacity: 1; }

.im-admin-panel { display: none; }
.im-admin-panel--active { display: block; }

/* Toolbar: search/filter + action button side by side */
.im-section-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.im-section-toolbar .im-dash-filters {
  flex: 1;
  min-width: 0;
}

/* =====================================================================
   MULTI-SELECT USER PICKER
===================================================================== */
.im-user-picker {
  position: relative;
  border: 1.5px solid var(--im-border);
  border-radius: var(--im-radius-sm);
  background: var(--im-surface);
  transition: border-color var(--im-transition);
  min-height: 44px;
  cursor: text;
}
.im-user-picker:focus-within {
  border-color: var(--im-accent);
  box-shadow: 0 0 0 3px rgba(90,165,212,.2);
}

.im-user-picker__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 10px;
  align-items: center;
  min-height: 42px;
}

.im-user-picker__input {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 3px 4px !important;
  min-width: 140px;
  flex: 1;
  background: transparent !important;
  font-size: 13.5px;
  color: var(--im-text);
}

.im-user-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--im-accent-bg);
  border: 1px solid rgba(26,86,219,.2);
  color: var(--im-accent);
  border-radius: 20px;
  padding: 3px 10px 3px 10px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  max-width: 200px;
}
.im-user-tag span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.im-user-tag__remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--im-accent);
  opacity: .6;
  padding: 0;
  line-height: 1;
  font-size: 14px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.im-user-tag__remove:hover { opacity: 1; }

.im-user-picker .im-autocomplete-list {
  top: 100%;
}

/* =====================================================================
   PAGINATION
===================================================================== */
.im-pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.im-page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1.5px solid var(--im-border);
  border-radius: var(--im-radius-sm);
  background: var(--im-surface);
  color: var(--im-text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--im-transition);
  font-family: var(--im-font);
}
.im-page-btn:hover:not(:disabled) {
  background: #003e6b;
  color: #fff;
  border-color: #003e6b;
}
.im-page-btn--active {
  background: #003e6b;
  color: #fff;
  border-color: #003e6b;
}
.im-page-btn:disabled { opacity: .35; cursor: default; }

.im-page-ellipsis {
  padding: 0 4px;
  color: var(--im-text-3);
  font-size: 13px;
  line-height: 32px;
}


/* =====================================================================
   LAYOUT — Page Shell, Nav offset, Full-page dashboard
===================================================================== */

/* Base shell */
.im-page-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--im-bg);
  font-family: var(--im-font);
}

/* Offset fixed nav */
.im-page-shell { padding-top: 58px; }
body.admin-bar .im-page-shell { padding-top: 90px; }

/* Page content area */
.im-page-content {
  flex: 1;
  width: 100%;
  max-width: none;
  padding: 16px 28px 12px;
  box-sizing: border-box;
  overflow-y: visible;
}
.im-page-content .im-wrap {
  padding: 0;
  min-height: unset;
  max-width: none;
  margin: 0;
}

/* ── Full-page layout (wide, but scrolls normally) ── */
@media (min-width: 769px) {
  body.im-fullpage .im-page-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }

  body.im-fullpage .im-page-content {
    display: flex;
    flex-direction: column;
  }
}

/* On mobile, fullpage pages scroll normally */
@media (max-width: 768px) {
  body.im-fullpage,
  body.im-fullpage .im-page-shell,
  body.im-fullpage .im-page-content {
    position: static;
    overflow: visible;
    height: auto;
    inset: auto;
  }
  body.im-fullpage .im-page-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: 90px;
  }
}

/* Dashboard container — fills the page shell */
#im-combined-dashboard {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#im-combined-dashboard .im-dash-header { flex-shrink: 0; }
#im-combined-dashboard .im-ctx-nav     { flex-shrink: 0; }

/* Context-level Dashboard/Reports nav bar */
.im-ctx-nav {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--im-border);
  margin-bottom: 16px;
}
.im-ctx-nav-btn {
  padding: 9px 18px;
  border: none !important;
  background: none !important;
  font-family: var(--im-font);
  font-size: 14px;
  font-weight: 600;
  color: var(--im-text-3);
  cursor: pointer;
  border-bottom: 3px solid transparent !important;
  margin-bottom: -2px;
  outline: none !important;
  box-shadow: none !important;
  -webkit-appearance: none;
  appearance: none;
  transition: color .12s;
}
.im-ctx-nav-btn--active {
  color: var(--im-accent) !important;
  border-bottom-color: var(--im-accent) !important;
}
.im-ctx-nav-btn:hover:not(.im-ctx-nav-btn--active) {
  color: var(--im-text-2) !important;
  background: none !important;
}

/* Each module context fills remaining space */
.im-module-ctx {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.im-module-ctx--active {
  display: flex;
}

/* Context panels fill available space */
.im-ctx-panel { display: none; flex: 1; min-height: 0; flex-direction: column; }
.im-ctx-panel--active { display: flex; }
/* Reports panels override to allow scrolling */
#ctx-inspections-reports, #ctx-pbv-reports { overflow-y: auto !important; }

/* Dashboard panel scrolls naturally with the page */
#ctx-inspections-dashboard,
#ctx-pbv-dashboard {
  overflow: visible;
}

/* Reports panel — scrollable column */
#ctx-inspections-reports,
#ctx-pbv-reports {
  display: none;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  gap: 12px;
  padding-bottom: 24px;
}
#ctx-inspections-reports.im-ctx-panel--active,
#ctx-pbv-reports.im-ctx-panel--active {
  display: flex;
}

/* Reports filter bar */
#ctx-inspections-reports .im-dash-filters,
#ctx-pbv-reports .im-dash-filters {
  flex-shrink: 0;
  margin-bottom: 0 !important;
}

/* KPI row in reports — compact */
#rpt-insp-kpis,
#rpt-pbv-kpis {
  flex-shrink: 0;
  margin-bottom: 0 !important;
}
#rpt-insp-kpis .im-stat-card,
#rpt-pbv-kpis .im-stat-card {
  padding: 10px 12px;
}
#rpt-insp-kpis .im-stat-card__value,
#rpt-pbv-kpis .im-stat-card__value {
  font-size: 22px;
}

/* Reports body: vertical flex — charts row on top, table below */
.im-report-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: visible;
}

/* Charts row: two charts side by side, fixed height */
.im-report-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  height: 260px;
  flex-shrink: 0;
}
.im-report-charts > div {
  overflow: hidden;
  padding: 14px 16px !important;
  background: #fff;
  border-radius: var(--im-radius);
  border: 1px solid var(--im-border);
}
.im-report-charts canvas {
  width: 100% !important;
  max-height: 200px !important;
}

/* Results table — natural height, paginated at 7 rows */
#rpt-insp-table-wrap,
#rpt-pbv-table-wrap {
  flex-shrink: 0;
}
#rpt-insp-table-wrap .im-table-wrap,
#rpt-pbv-table-wrap .im-table-wrap {
  overflow: visible;
}

/* Module panels wrapper */
.im-module-panels {
  width: 100%;
}

/* Individual panels */
.im-module-panel { display: none !important; }
.im-module-panel--active {
  display: block !important;
}

/* Stats, header, tabs, filters — don't grow */
.im-dash-header,
.im-stats-grid,
.im-module-tabs,
.im-dash-filters { flex-shrink: 0; }

/* Table wrap - natural height, tbody scrolls */
.im-table-wrap {
  overflow: hidden;
  background: var(--im-surface);
  border: 1px solid var(--im-border);
  border-radius: var(--im-radius);
  box-shadow: var(--im-shadow);
}

/* Fixed header, scrolling body */
.im-table-wrap .im-table {
  width: 100%;
  border-collapse: collapse;
}
.im-table-wrap .im-table thead {
  display: table;
  width: 100%;
  table-layout: fixed;
}
.im-table-wrap .im-table tbody {
  display: block;
  overflow-y: auto;
  height: 200px; /* JS overrides this */
}
.im-table-wrap .im-table tbody tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

/* Table footer pinned at bottom */
.im-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--im-bg);
  border-top: 1px solid var(--im-border);
  flex-shrink: 0;
  font-size: 12px;
  color: var(--im-text-3);
  font-family: var(--im-mono);
}
body.admin-bar .im-nav__dropdown { top: 90px; }

/* Multi-picker autocomplete positioning fix */
[id$="-wrap"] .im-autocomplete-list,
[id$="results-wrap"] .im-autocomplete-list {
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  width: 100%;
  z-index: 9999;
}

/* User picker body-level dropdown */
.im-upk-dropdown {
  position: fixed;
  z-index: 999999;
  display: none;
  background: var(--im-surface, #fff);
  border: 1.5px solid var(--im-border, #d1d9e0);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,.14);
  list-style: none;
  margin: 0;
  padding: 4px 0;
  max-height: 240px;
  overflow-y: auto;
  min-width: 180px;
}
.im-upk-dropdown li {
  padding: 8px 14px;
  font-size: 13.5px;
  cursor: pointer;
  color: var(--im-text, #1a2332);
}
.im-upk-dropdown li:hover {
  background: var(--im-accent-bg, #e8f0fe);
  color: var(--im-accent, #1a56db);
}

/* ======================================================================
   PROMOTIONS & TRANSFERS — Two-column layout + messages panel
====================================================================== */

/* The layout wrapper: flex row so form + messages sit side by side */
#im-promo-wrap.im-promo-layout {
  display: flex !important;
  flex-direction: row;
  align-items: flex-start;
  gap: 0;
  max-width: none;
  padding: 0;
  background: var(--im-bg);
}

.im-promo-main {
  flex: 1 1 0;
  min-width: 0;
  padding: 28px 28px 60px;
  overflow: visible;
  border-right: 1px solid #dce8f0;
}

/* Messages panel — sticks to viewport as you scroll the form */
.im-promo-messages {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  border-left: 1px solid #dce8f0;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow: hidden;
  align-self: flex-start;
}

.im-promo-messages__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: #fff;
  border-bottom: 1px solid #dce8f0;
  font-size: 13px;
  font-weight: 600;
  color: var(--im-text);
  flex-shrink: 0;
}

.im-promo-messages__header > svg {
  width: 16px;
  height: 16px;
  color: #f59e0b;
  flex-shrink: 0;
}

.im-promo-messages__avatars {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.im-promo-msg-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  border: 2px solid #fff;
  margin-left: -5px;
  flex-shrink: 0;
}

.im-promo-messages__thread {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.im-promo-messages__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #94a3b8;
  text-align: center;
  gap: 8px;
}

.im-promo-messages__empty > svg {
  width: 44px;
  height: 44px;
  opacity: 0.3;
}

.im-promo-messages__empty p {
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}

.im-promo-msg-bubble {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.im-promo-msg-bubble__meta {
  display: flex;
  align-items: center;
  gap: 5px;
}

.im-promo-msg-bubble__name {
  font-size: 12px;
  font-weight: 600;
  color: var(--im-text);
}

.im-promo-msg-bubble__time {
  font-size: 11px;
  color: #94a3b8;
}

.im-promo-msg-bubble__text {
  background: #fff;
  border: 1px solid #dce8f0;
  border-radius: 0 8px 8px 8px;
  padding: 7px 11px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--im-text);
  white-space: pre-wrap;
}

.im-promo-messages__compose {
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #dce8f0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex-shrink: 0;
}

.im-promo-messages__input {
  width: 100%;
  border: 1px solid #c9dce8;
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 13px;
  color: var(--im-text);
  resize: none;
  background: #f8fafc;
  line-height: 1.5;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}

.im-promo-messages__input:focus {
  outline: none;
  border-color: var(--im-accent);
  box-shadow: 0 0 0 3px rgba(0,62,107,.1);
  background: #fff;
}

#im-promo-msg-send {
  width: 100%;
  font-size: 12px;
  padding: 9px 12px;
  background: linear-gradient(135deg, #7c3aed, #5b21b6) !important;
  border-color: #7c3aed !important;
}

#im-promo-msg-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ---- Radio group — override global .im-radio-label pill style ---- */
.im-promo-main .im-radio-group {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  padding: 4px 0;
}

.im-promo-main .im-radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  cursor: pointer;
  font-weight: 500;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  background: none !important;
}

/* Show the actual radio input — global rule hides it, we need it back here */
.im-promo-main .im-radio-label input[type="radio"] {
  display: inline-block !important;
  width: 15px;
  height: 15px;
  margin: 0;
  cursor: pointer;
  accent-color: #7c3aed;
}

.im-promo-main .im-radio-label--neutral { color: var(--im-text); }
.im-promo-main .im-radio-label--yes     { color: #15803d; }
.im-promo-main .im-radio-label--no      { color: #b91c1c; }

/* ---- Submit / send button colour ---- */
.im-promo-submit-btn {
  background: linear-gradient(135deg, #7c3aed, #5b21b6) !important;
  border-color: #7c3aed !important;
}
.im-promo-submit-btn:hover {
  background: linear-gradient(135deg, #6d28d9, #4c1d95) !important;
}

/* New Promo / Transfer button on the standalone dashboard */
.im-promo-new-btn {
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  border: 1px solid #7c3aed;
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 18px;
  height: 40px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s, box-shadow .15s;
}
.im-promo-new-btn svg { width: 16px; height: 16px; }
.im-promo-new-btn:hover {
  background: linear-gradient(135deg, #6d28d9, #4c1d95);
  box-shadow: 0 2px 8px rgba(124,58,237,.35);
}

/* Approval badge */
.im-promo-approval-badge {
  font-size: 11px !important;
  font-weight: 600 !important;
  padding: 2px 8px !important;
  border-radius: 10px !important;
}


/* ======================================================================
   ADMIN — delete action button
====================================================================== */
.im-action-btn--delete {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

.im-action-btn--delete:hover {
  background: #fecaca;
  border-color: #f87171;
}

/* ======================================================================
   STAT CARD — generic color var support
====================================================================== */
.im-stat-card {
  --stat-color: var(--im-accent);
  border-top-color: var(--stat-color);
}
.im-stat-card .im-stat-card__value {
  color: var(--stat-color);
}

/* ======================================================================
   PROMO FORM — autocomplete dropdowns above messages panel
====================================================================== */
.im-promo-main .im-autocomplete-wrap { position: relative; }
.im-promo-main .im-autocomplete-list {
  position: absolute;
  z-index: 9999;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #c9dce8;
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 12px rgba(0,62,107,.12);
  max-height: 220px;
  overflow-y: auto;
  list-style: none;
  padding: 0;
  margin: 0;
}
.im-promo-main .im-autocomplete-list li {
  padding: 9px 14px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid #edf2f7;
  color: var(--im-text);
}
.im-promo-main .im-autocomplete-list li:hover {
  background: var(--im-accent-bg);
  color: var(--im-accent);
}

/* User picker inside promo form */
.im-promo-main .im-user-picker {
  position: relative;
}
.im-promo-main .im-user-picker .im-autocomplete-list {
  top: 100%;
  border-top: none;
}

/* ======================================================================
   PROMO DASHBOARD — im-wrap max-width override
====================================================================== */
#im-promos-dashboard.im-wrap {
  max-width: none;
  padding: 0 0 60px;
}

/* ======================================================================
   RESPONSIVE — Tablet & Mobile
   Breakpoints: 1024px (tablet), 768px (large mobile), 480px (small mobile)
====================================================================== */

/* ── Tablet (≤1024px) ─────────────────────────────────────────────── */
@media (max-width: 1024px) {

  /* Wrap padding */
  .im-wrap { padding: 16px 16px 40px; }
  .im-page-content .im-wrap { padding: 16px; }

  /* Form header */
  .im-form-header { gap: 12px; }
  .im-form-header__title { font-size: 18px; }

  /* Section toolbar: stack on tablet */
  .im-section-toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .im-section-toolbar .im-btn { white-space: nowrap; }

  /* Filters wrap */
  .im-dash-filters { flex-wrap: wrap; gap: 8px; }
  .im-dash-filters .im-filter-select { width: 130px !important; min-width: 110px; }

  /* Stat cards: 4 → 2 columns on tablet */
  .im-promo-stats-row { grid-template-columns: repeat(2, 1fr) !important; }
  #promo-stat-total,
  #promo-stat-submitted,
  #promo-stat-approved,
  #promo-stat-rejected { font-size: 20px; }

  /* Table: allow horizontal scroll */
  .im-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .im-table { min-width: 600px; }

  /* Promo form: stack messages below on tablet */
  #im-promo-wrap.im-promo-layout,
  #im-promo-wrap {
    flex-direction: column !important;
    min-height: 0 !important;
  }
  .im-promo-main {
    padding: 20px 16px 40px;
    border-right: none !important;
    border-bottom: 1px solid #dce8f0;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .im-promo-messages {
    width: 100% !important;
    height: auto !important;
    min-height: 320px;
    max-height: 480px;
    position: static !important;
    top: auto !important;
    border-left: none !important;
    border-top: 1px solid #dce8f0;
    box-sizing: border-box !important;
  }

  /* Modal: full width */
  .im-modal__dialog { width: calc(100vw - 32px) !important; max-width: 100% !important; }

  /* Dashboard header actions: wrap */
  .im-dash-header { flex-wrap: wrap; gap: 10px; }
  .im-dash-header-actions { flex-wrap: wrap; }

  /* Promo form tabs: wrap if needed */
  #im-promo-tabs { flex-wrap: wrap; gap: 4px; }
}

/* ── Mobile (≤768px) ──────────────────────────────────────────────── */
@media (max-width: 768px) {

  /* Base wrap */
  .im-wrap { padding: 12px 12px 32px; max-width: 100%; }
  .im-page-content .im-wrap { padding: 12px; }
  #im-promos-dashboard.im-wrap { padding: 0 0 32px; }

  /* Nav already handled above (links hide, hamburger shows) */

  /* Page shell */
  .im-page-shell { padding-top: 90px; }

  /* Form header: tighten */
  .im-form-header { padding: 14px 16px; flex-wrap: wrap; }
  .im-form-header__title { font-size: 16px; }
  .im-form-header__sub { font-size: 12px; }
  .im-form-header__icon { width: 36px; height: 36px; }

  /* All grids go single column on mobile */
  .im-grid--2, .im-grid--3 { grid-template-columns: 1fr !important; }

  /* Section: tighter padding */
  .im-section { padding: 16px; }
  .im-section__title { font-size: 10px; margin-bottom: 14px; }

  /* Section toolbar: stack vertically */
  .im-section-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .im-section-toolbar .im-btn { width: 100%; justify-content: center; }

  /* Dash header */
  .im-dash-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .im-dash-header-actions { width: 100%; }
  .im-dash-header-actions .im-btn { flex: 1; justify-content: center; min-width: 0; }

  /* Filters: stack */
  .im-dash-filters { flex-direction: column; gap: 8px; }
  .im-dash-filters input,
  .im-dash-filters .im-filter-select,
  .im-dash-filters .im-input { width: 100% !important; min-width: 0; flex: none !important; }

  /* Stat cards: 2 columns */
  .im-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .im-promo-stats-row { grid-template-columns: repeat(2, 1fr) !important; }

  /* Tables: scrollable */
  .im-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .im-table { min-width: 520px; font-size: 12px; }
  .im-table th, .im-table td { padding: 8px 10px; }

  /* Promo layout: stacked */
  .im-promo-messages { max-height: 400px; }

  /* Tabs */
  .im-tabs { gap: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  .im-tab { padding: 10px 14px; font-size: 12px; flex-shrink: 0; }
  #im-promo-tabs { flex-wrap: nowrap; overflow-x: auto; }
  #im-promo-tabs button { flex-shrink: 0; font-size: 12px; padding: 9px 14px; }

  /* Form actions: stack buttons */
  .im-form-actions { flex-direction: column; gap: 8px; padding: 14px 12px; }
  .im-form-actions .im-btn { width: 100%; justify-content: center; text-align: center; }

  /* Buttons: keep reasonable size */
  .im-btn { padding: 9px 16px; font-size: 13px; }

  /* Modal: full screen on mobile */
  .im-modal-overlay { align-items: flex-end; padding: 0; }
  .im-modal__dialog {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 16px 16px 0 0 !important;
    max-height: 90vh;
    overflow-y: auto;
  }

  /* Status area badges */
  .im-badge { font-size: 10px; padding: 2px 8px; }

  /* Promo form inline messages panel */
  .im-promo-messages { min-height: 300px; max-height: 380px; }

  /* Pagination */
  .im-pagination { flex-wrap: wrap; gap: 4px; justify-content: center; }

  /* User picker tags: wrap nicely */
  .im-user-picker { min-height: 38px; }

  /* Radio pills: wrap on mobile */
  .im-radio-group { flex-wrap: wrap; gap: 6px; }

  /* Login page */
  .im-login-wrap { padding: 16px; }
  .im-login-card { padding: 24px 20px; }
}

/* ── Small mobile (≤480px) ────────────────────────────────────────── */
@media (max-width: 480px) {

  .im-wrap { padding: 10px 10px 24px; }

  /* Nav brand: shorten */
  .im-nav__brand { font-size: 14px; }

  /* Stats: single column on tiny screens */
  .im-promo-stats-row { grid-template-columns: repeat(2, 1fr) !important; }

  /* Promo tabs: always scrollable row */
  #im-promo-tabs { gap: 4px; }

  /* Form header */
  .im-form-header { gap: 10px; }
  .im-form-header__icon { display: none; }

  /* Section */
  .im-section { padding: 12px; }

  /* Inputs slightly smaller */
  .im-input, .im-select, .im-textarea { font-size: 14px; }

  /* Table font */
  .im-table { font-size: 11px; }
  .im-table th, .im-table td { padding: 7px 8px; }

  /* Action buttons in table: icon only hint */
  .im-action-btn { padding: 5px 10px; font-size: 11px; }

  /* Modal full screen */
  .im-modal__dialog { border-radius: 12px 12px 0 0 !important; }
}

/* ── Touch-friendly tap targets ───────────────────────────────────── */
@media (hover: none) and (pointer: coarse) {
  .im-btn       { min-height: 44px; }
  .im-input,
  .im-select    { min-height: 44px; }
  .im-tab       { min-height: 40px; }
  .im-action-btn { min-height: 36px; }
  .im-nav__link  { min-height: 44px; }
  .im-checkbox-label,
  .im-radio-label { min-height: 36px; cursor: pointer; }
}

/* ======================================================================
   MOBILE CARD LAYOUT — Tables become stacked cards on small screens
====================================================================== */
@media (max-width: 640px) {

  /* Hide the table header row */
  .im-table thead { display: none; }

  /* Each row becomes a card */
  .im-table,
  .im-table tbody,
  .im-table tr { display: block; width: 100%; }

  .im-table tr {
    border: 1px solid var(--im-border);
    border-radius: 10px;
    margin-bottom: 12px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    overflow: hidden;
  }

  .im-table tr:hover { background: #fff; }

  /* Each cell becomes a label+value row */
  .im-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 14px;
    border-bottom: 1px solid #f0f4f8;
    border-left: none;
    border-right: none;
    font-size: 13px;
    gap: 12px;
  }

  .im-table td:last-child { border-bottom: none; }

  /* Label from data-label attribute */
  .im-table td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--im-text-3);
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 90px;
  }

  /* Value sits on the right */
  .im-table td > * { text-align: right; }
  .im-table td > span,
  .im-table td > a { text-align: right; }

  /* Actions cell — button full width */
  .im-table td[data-label="Actions"] {
    justify-content: flex-end;
    padding: 10px 14px;
  }
  .im-table td[data-label="Actions"]::before { display: none; }
  .im-table td[data-label="Actions"] .im-action-btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  /* Table wrap: remove horizontal scroll (not needed with cards) */
  .im-table-wrap { overflow-x: visible; }
  .im-table { min-width: 0; }

  /* Table footer */
  .im-table-footer { padding: 10px 0; font-size: 12px; }

  /* Empty state */
  .im-table-empty { padding: 24px 16px; }
}

/* ======================================================================
   MOBILE SCROLL FIXES
   On mobile, tables use natural height (no fixed tbody height).
   Pages scroll via the browser, not internal scroll containers.
====================================================================== */
@media (max-width: 768px) {

  /* Let page-content grow naturally */
  .im-page-content {
    padding: 12px 12px 32px;
    overflow-y: visible;
    height: auto;
  }

  /* Remove fixed tbody height — cards layout makes it irrelevant */
  .im-table-wrap .im-table tbody {
    display: block;
    overflow-y: visible;
    height: auto !important;
    max-height: none !important;
  }

  /* Table wrap: natural height, no clipping */
  .im-table-wrap {
    overflow: visible;
    height: auto;
  }

  /* thead hidden in card mode (already handled) but reset display */
  .im-table-wrap .im-table thead {
    display: none;
  }

  /* tbody rows: display block (card mode) */
  .im-table-wrap .im-table tbody tr {
    display: block;
    width: 100%;
  }

  /* Dashboard containers: natural height, scrollable via page */
  #im-combined-dashboard,
  .im-module-panels,
  .im-module-panel--active {
    height: auto !important;
    overflow: visible !important;
    min-height: 0;
  }

  /* Promo dashboard */
  #im-promos-dashboard.im-wrap {
    height: auto;
    overflow: visible;
    padding-bottom: 40px;
  }
}

/* ======================================================================
   PROMOTIONS DASHBOARD — Mobile fixes
====================================================================== */
@media (max-width: 640px) {

  /* Header: stack title and button */
  .im-dash-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 14px;
  }
  .im-dash-header__title { font-size: 20px; }
  .im-dash-header-actions { width: 100%; }
  .im-dash-header-actions .im-btn,
  .im-dash-header-actions .im-promo-new-btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  /* Stat cards: 2x2 grid */
  .im-stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
    margin-bottom: 12px;
  }
  .im-stat-card__value { font-size: 26px; }
  .im-stat-card { padding: 12px; }

  /* Filters: stack vertically, override inline margin-left */
  .im-dash-filters {
    flex-direction: column;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
  }
  .im-search-wrap { width: 100%; }
  .im-dash-filters .im-select,
  .im-dash-filters .im-filter-select {
    width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    flex-shrink: unset;
  }
  .im-dash-filters .im-btn {
    width: 100%;
    justify-content: center;
  }

  /* Table footer: stack count and pagination */
  .im-table-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
  }
  .im-pagination { flex-wrap: wrap; }
}

/* ── Combined dashboard mobile fixes ── */
@media (max-width: 640px) {

  /* Header: title + compact buttons side by side */
  #im-combined-dashboard .im-dash-header {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
  }
  #im-combined-dashboard .im-dash-header-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    flex-shrink: 0;
  }
  #im-combined-dashboard .im-dash-header-actions .im-btn {
    width: auto;
    padding: 6px 12px;
    font-size: 12px;
    gap: 4px;
    white-space: nowrap;
  }
  #im-combined-dashboard .im-dash-header-actions .im-btn svg {
    width: 13px;
    height: 13px;
  }

  /* Module tabs: full width, side by side */
  .im-module-tabs {
    display: flex;
    width: 100%;
    gap: 6px;
    margin-bottom: 10px;
  }
  .im-module-tab {
    flex: 1;
    justify-content: center;
    font-size: 13px;
    padding: 9px 10px;
  }
}

/* ======================================================================
   MOBILE BUTTON + PROMO FORM FIXES
====================================================================== */
@media (max-width: 640px) {

  /* ── Smaller buttons ── */
  .im-btn {
    padding: 8px 14px !important;
    font-size: 13px !important;
    gap: 5px !important;
  }
  .im-btn svg { width: 14px !important; height: 14px !important; }

  .im-promo-new-btn {
    padding: 0 14px !important;
    height: 36px !important;
    font-size: 13px !important;
  }

  /* ── Promo form: stack layout ── */
  #im-promo-wrap.im-promo-layout {
    flex-direction: column !important;
  }

  .im-promo-main {
    padding: 16px 14px 40px !important;
    border-right: none !important;
    border-bottom: 1px solid #dce8f0;
    width: 100% !important;
  }

  /* Messages panel: natural height, no sticky */
  .im-promo-messages {
    width: 100% !important;
    height: auto !important;
    min-height: 300px !important;
    max-height: 400px !important;
    position: static !important;
    top: auto !important;
    border-left: none !important;
    border-top: 1px solid #dce8f0;
  }

  /* Promo tabs: scrollable row */
  #im-promo-tabs {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 4px !important;
    padding-bottom: 4px !important;
  }
  #im-promo-tabs button {
    flex-shrink: 0 !important;
    font-size: 12px !important;
    padding: 8px 12px !important;
    white-space: nowrap !important;
  }

  /* Promo form grid: single column */
  .im-promo-main .im-grid--2,
  .im-promo-main .im-grid--3 {
    grid-template-columns: 1fr !important;
  }

  /* Radio pills: wrap */
  .im-promo-main .im-radio-group {
    flex-wrap: wrap !important;
    gap: 10px !important;
  }

  /* Form action bar at bottom */
  .im-promo-actions,
  .im-promo-main .im-form-actions {
    flex-direction: column !important;
    gap: 8px !important;
    padding: 12px 14px !important;
  }
  .im-promo-actions .im-btn,
  .im-promo-main .im-form-actions .im-btn {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Section titles spacing */
  .im-promo-main .im-section {
    padding: 14px !important;
    margin-bottom: 10px !important;
  }
}

/* ── Ticket attachments ─────────────────────────────────────────── */
.tk-att-del:hover { background: #b91c1c !important; }

/* ── Reports panel charts grid ───────────────────────────────────────────── */
.im-report-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.im-surface {
  background: var(--im-surface);
}

/* ── PBV badge colors for new statuses ───────────────────────────────────── */
.im-badge--submitted          { background:#dbeafe; color:#1e40af; }
.im-badge--under_review       { background:#ede9fe; color:#5b21b6; }
.im-badge--pre_approved_move_in { background:#d1fae5; color:#065f46; }
.im-badge--pending_transfer   { background:#fef3c7; color:#92400e; }
.im-badge--resubmit           { background:#fef9c3; color:#854d0e; }
.im-badge--cancelled          { background:#f1f5f9; color:#475569; }

/* ═══════════════════════════════════════════════════════════
   FORM MODALS (Inspection + PBV)
═══════════════════════════════════════════════════════════ */
.im-form-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 40px 16px;
}
.im-form-modal__overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(2px);
}
.im-form-modal__box {
  position: relative;
  background: var(--im-surface);
  border-radius: 12px;
  width: 100%;
  max-width: 1080px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  overflow: hidden;
}
.im-form-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
  width: 34px;
  height: 34px;
  border: none;
  background: rgba(0,0,0,.08);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--im-text);
  transition: background .15s;
}
.im-form-modal__close:hover { background: rgba(0,0,0,.15); }
.im-form-modal__close svg { width: 16px; height: 16px; }
.im-form-modal__inner {
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}

/* Form content inside modal — remove outer page padding */
.im-wrap--modal {
  padding: 28px 32px 32px;
  max-width: none;
  margin: 0;
  min-height: 0;
  background: var(--im-surface);
}
.im-wrap--modal .im-form-header { padding-top: 0; margin-bottom: 20px; }

/* ═══════════════════════════════════════════════════════════
   INSPECTION MESSAGES PANEL (inside Messages tab)
═══════════════════════════════════════════════════════════ */
.im-insp-messages {
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  border: 1px solid var(--im-border);
  border-radius: var(--im-radius);
  min-height: 420px;
  max-height: 520px;
  overflow: hidden;
}
.im-insp-messages__thread {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 240px;
}
.im-insp-messages__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #94a3b8;
  text-align: center;
  gap: 10px;
}
.im-insp-messages__empty svg {
  width: 40px !important;
  height: 40px !important;
  opacity: .3;
}
.im-insp-messages__empty p {
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
  max-width: 280px;
}
.im-insp-messages__compose {
  padding: 12px 14px;
  background: #fff;
  border-top: 1px solid var(--im-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.im-insp-messages__textarea {
  width: 100%;
  border: 1.5px solid #c9dce8;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  resize: none;
  background: #f8fafc;
  font-family: inherit;
  line-height: 1.5;
  transition: border-color .15s, box-shadow .15s;
}
.im-insp-messages__textarea:focus {
  outline: none;
  border-color: #003e6b;
  box-shadow: 0 0 0 3px rgba(0,62,107,.1);
  background: #fff;
}
/* To: picker — navy themed for inspections */
#im-insp-msg-to-wrap.im-msg-to-wrap:focus-within {
  border-color: #003e6b;
  box-shadow: 0 0 0 3px rgba(0,62,107,.1);
}
#im-insp-msg-to-tags .im-msg-to-tag {
  background: #dbeafe;
  color: #1e40af;
}
/* Send button — navy */
.im-insp-msg-send-btn {
  width: 100%;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  background: linear-gradient(135deg, #003e6b, #002d4e) !important;
  border: 1px solid #003e6b !important;
  color: #fff !important;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity .15s;
}
.im-insp-msg-send-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════
   SHARED MESSAGE COMPONENTS (TO picker, message bubbles)
   Used by both Promotions and Inspections messages
═══════════════════════════════════════════════════════════ */
.im-msg-to-wrap {
  position: relative;
  border: 1.5px solid #c9dce8;
  border-radius: 8px;
  background: #f8fafc;
  min-height: 34px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  cursor: text;
}
.im-msg-to-wrap:focus-within {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124,58,237,.1);
  background: #fff;
}
.im-msg-to-label {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: .04em;
  white-space: nowrap;
  padding-right: 2px;
}
.im-msg-to-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #ede9fe;
  color: #5b21b6;
  border-radius: 4px;
  padding: 2px 7px 2px 8px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.im-msg-to-tag__remove {
  cursor: pointer;
  opacity: .6;
  font-size: 14px;
  line-height: 1;
  margin-left: 2px;
  font-weight: 700;
}
.im-msg-to-tag__remove:hover { opacity: 1; }
.im-msg-to-input {
  border: none;
  outline: none;
  background: none;
  font-size: 12px;
  font-family: inherit;
  flex: 1;
  min-width: 80px;
  padding: 2px 0;
}
.im-msg-to-dropdown {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1.5px solid #dce8f0;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  max-height: 180px;
  overflow-y: auto;
  z-index: 300;
  display: none;
}
.im-msg-to-dropdown li {
  list-style: none;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.im-msg-to-dropdown li:hover,
.im-msg-to-dropdown li.is-active { background: #f5f3ff; }
.im-msg-to-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* Message bubbles */
.im-msg-bubble {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.im-msg-bubble__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.im-msg-bubble__avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.im-msg-bubble__name {
  font-size: 12px;
  font-weight: 600;
  color: #003e6b;
}
.im-msg-bubble__time {
  font-size: 11px;
  color: #94a3b8;
}
.im-msg-bubble__text {
  background: #fff;
  border: 1px solid #dce8f0;
  border-radius: 0 8px 8px 8px;
  padding: 7px 11px;
  font-size: 13px;
  line-height: 1.5;
  color: #003e6b;
  white-space: pre-wrap;
  word-break: break-word;
}
/* Tagged user chips shown on bubbles */
.im-msg-tagged {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.im-msg-tagged__chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #ede9fe;
  color: #5b21b6;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
}

/* ── Picker modal (used by PBV Defaults overrides) ── */
.im-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 62, 107, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}
.im-modal-backdrop .im-modal {
  background: var(--im-surface);
  border: 1px solid var(--im-border);
  border-radius: var(--im-radius);
  padding: 24px 28px;
  box-shadow: 0 20px 60px rgba(0,62,107,.25);
  width: 100%;
  max-width: 520px;
}

/* ---- Multi-assignee chip picker (PBV form) ---- */
.im-multiassign-wrap {
  position: relative;
}
.im-multiassign-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 6px;
  min-height: 0;
}
.im-multiassign-chips:empty {
  display: none;
}
.im-multiassign-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px 4px 10px;
  background: var(--im-accent-bg);
  border: 1px solid var(--im-border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--im-text);
  font-weight: 500;
}
.im-multiassign-chip__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 0;
  background: transparent;
  color: var(--im-text-3);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  padding: 0;
  transition: all 0.15s;
}
.im-multiassign-chip__remove:hover {
  background: var(--im-danger);
  color: #fff;
}

/* ---- Clickable stat cards (filter shortcut) ---- */
.im-stat-card[role="button"] {
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.im-stat-card[role="button"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 62, 107, 0.12);
}
.im-stat-card[role="button"]:focus-visible {
  outline: 2px solid var(--im-accent);
  outline-offset: 2px;
}

/* PBV dashboard has 7 cards (Total, Submitted, Approved, Rejected, Cancelled, Pre-Approved Move In, Re-Submitted) */
#im-pbv-stats.im-stats-grid {
  grid-template-columns: repeat(7, 1fr);
}
@media (max-width: 1100px) {
  #im-pbv-stats.im-stats-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 900px) {
  #im-pbv-stats.im-stats-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 500px) {
  #im-pbv-stats.im-stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ---- Permission Inspector button ---- */
.im-action-btn--inspect {
  color: var(--im-accent);
  border-color: var(--im-border);
}
.im-action-btn--inspect:hover {
  background: var(--im-bg);
  border-color: var(--im-accent);
}

/* ---- Bulk actions bar ---- */
.im-bulk-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fbbf24;
  border-radius: 8px;
  font-size: 13px;
}
.im-bulk-bar__count {
  font-weight: 700;
  color: var(--im-text);
  white-space: nowrap;
}
.im-bulk-bar__select {
  flex: 0 1 240px;
  max-width: 240px;
}
.im-bulk-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.im-bulk-cell {
  vertical-align: middle !important;
}
