/* ═══════════════════════════════════════════════════════════════
   JBA Field Inspector App v2 — Industrial Precision Design
   Font: IBM Plex Mono + IBM Plex Sans
═══════════════════════════════════════════════════════════════ */

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

:root {
  --navy:      #0a1628;
  --navy-mid:  #112240;
  --navy-light:#1a3560;
  --blue:      #1e5fd8;
  --blue-bright:#2d7fff;
  --accent:    #f5a623;
  --red:       #e03535;
  --green:     #1fba74;
  --teal:      #0bbcd4;
  --white:     #f8faff;
  --gray-100:  #f0f4f9;
  --gray-200:  #dce4f0;
  --gray-400:  #8898b0;
  --gray-600:  #4a5a72;
  --card-bg:   #ffffff;
  --shadow-sm: 0 1px 4px rgba(10,22,40,0.08);
  --shadow-md: 0 4px 20px rgba(10,22,40,0.12);
  --shadow-lg: 0 12px 40px rgba(10,22,40,0.18);
  --radius:    6px;
  --radius-lg: 10px;
  --mono:      'IBM Plex Mono', monospace;
  --sans:      'IBM Plex Sans', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--navy);
  background: var(--gray-100);
  -webkit-font-smoothing: antialiased;
}

/* ── NAVBAR ──────────────────────────────────────────────────── */
.app-nav {
  background: var(--navy);
  border-bottom: 2px solid var(--blue);
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0,0,0,0.3);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.nav-logo {
  width: 32px;
  height: 32px;
  background: var(--blue);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.nav-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-subtitle {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--gray-400);
  letter-spacing: 0.06em;
}

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

.btn-nav {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.8);
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
  font-family: var(--sans);
}

.btn-nav:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.4);
  color: #fff;
}

.btn-nav-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.btn-nav-primary:hover {
  background: var(--blue-bright);
  border-color: var(--blue-bright);
  color: #fff;
}

/* ── LAYOUT ──────────────────────────────────────────────────── */
.page-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

.page-wrap-wide {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 20px 60px;
}

/* ── CARDS ───────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  margin-bottom: 12px;
}

.card-header {
  background: var(--navy-mid);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.card-header-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.9);
  flex: 1;
}

.step-num {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--blue-bright);
  background: rgba(45,127,255,0.15);
  border: 1px solid rgba(45,127,255,0.3);
  border-radius: 3px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-body {
  padding: 16px;
}

/* ── FORM CONTROLS ───────────────────────────────────────────── */
.field-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-600);
  display: block;
  margin-bottom: 5px;
}

.field-label span.req {
  color: var(--red);
  margin-left: 2px;
}

.field-input {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--navy);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
}

.field-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(30,95,216,0.12);
}

.field-input::placeholder {
  color: var(--gray-400);
  font-style: italic;
}

.field-input.autofilled {
  border-color: var(--green);
  background: rgba(31,186,116,0.04);
}

textarea.field-input {
  resize: vertical;
  min-height: 70px;
}

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

.field-group { margin-bottom: 10px; }

/* ── DROP ZONE ───────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--gray-100);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
}

.drop-zone:hover {
  border-color: var(--blue);
  background: rgba(30,95,216,0.04);
}

.drop-zone.dragover {
  border-color: var(--blue-bright);
  background: rgba(45,127,255,0.08);
  transform: scale(1.01);
}

.drop-icon {
  font-size: 32px;
  color: var(--gray-400);
  transition: color 0.2s;
}

.drop-zone:hover .drop-icon {
  color: var(--blue);
}

.drop-label {
  font-weight: 600;
  font-size: 13px;
  color: var(--gray-600);
}

.drop-hint {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--gray-400);
}

.drop-zone-sm {
  padding: 16px 12px;
  gap: 6px;
}

/* ── PREVIEW ─────────────────────────────────────────────────── */
.preview-wrap {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--gray-200);
  margin-top: 12px;
}

.preview-img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  background: var(--gray-100);
  display: block;
}

.preview-footer {
  background: var(--gray-100);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--gray-200);
}

.preview-name {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--gray-600);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-remove {
  background: none;
  border: none;
  color: var(--red);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  transition: background 0.15s;
  flex-shrink: 0;
}

.btn-remove:hover { background: rgba(224,53,53,0.08); }

/* ── OCR STATUS ──────────────────────────────────────────────── */
.ocr-box {
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ocr-box.info    { background: rgba(30,95,216,0.06); border: 1px solid rgba(30,95,216,0.2); color: var(--navy-light); }
.ocr-box.success { background: rgba(31,186,116,0.06); border: 1px solid rgba(31,186,116,0.3); color: #0d5c3a; }
.ocr-box.warn    { background: rgba(245,166,35,0.06); border: 1px solid rgba(245,166,35,0.35); color: #7a4f00; }
.ocr-box.error   { background: rgba(224,53,53,0.06); border: 1px solid rgba(224,53,53,0.25); color: #7d1616; }

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

.ocr-bar-wrap {
  height: 3px;
  background: var(--gray-200);
  border-radius: 2px;
  overflow: hidden;
}

.ocr-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--blue-bright));
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ── REASON CARDS ────────────────────────────────────────────── */
.reason-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.reason-card {
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 16px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s;
  background: var(--white);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.reason-card::before {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: transparent;
  transition: background 0.18s;
}

.reason-card:hover {
  border-color: var(--blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.reason-card.selected {
  border-color: var(--blue);
  background: linear-gradient(160deg, rgba(30,95,216,0.04) 0%, rgba(45,127,255,0.08) 100%);
  box-shadow: 0 0 0 3px rgba(30,95,216,0.15);
}

.reason-card.selected::before { background: var(--blue); }

.reason-card input { display: none; }

.r-icon {
  font-size: 24px;
  line-height: 1;
}

.r-icon.bad    { color: var(--red); }
.r-icon.leave  { color: var(--accent); }
.r-icon.gated  { color: var(--teal); }
.r-icon.dog    { color: #e07b00; }
.r-icon.child  { color: #7c3aed; }

.r-label {
  font-weight: 700;
  font-size: 12px;
  color: var(--navy);
  line-height: 1.2;
}

.r-desc {
  font-size: 11px;
  color: var(--gray-400);
  line-height: 1.3;
}

/* ── SUBMIT BUTTON ───────────────────────────────────────────── */
.btn-submit {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--navy-light) 0%, var(--blue) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-lg);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(30,95,216,0.35);
  margin-bottom: 24px;
}

.btn-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(30,95,216,0.45);
}

.btn-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* ── TOAST ───────────────────────────────────────────────────── */
.toast-wrap {
  position: fixed;
  bottom: 20px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast-msg {
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
  max-width: 320px;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.toast-success { background: var(--navy); color: #fff; border-left: 4px solid var(--green); }
.toast-error   { background: var(--navy); color: #fff; border-left: 4px solid var(--red); }

/* ═══════════════════════════════════════════════════════════════
   DASHBOARD
═══════════════════════════════════════════════════════════════ */

/* ── STAT CARDS ──────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-tile {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.stat-tile::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
}

.stat-tile.blue::after  { background: var(--blue); }
.stat-tile.green::after { background: var(--green); }
.stat-tile.red::after   { background: var(--red); }
.stat-tile.amber::after { background: var(--accent); }

.stat-ico {
  font-size: 20px;
  margin-bottom: 8px;
  display: block;
}

.stat-tile.blue  .stat-ico { color: var(--blue); }
.stat-tile.green .stat-ico { color: var(--green); }
.stat-tile.red   .stat-ico { color: var(--red); }
.stat-tile.amber .stat-ico { color: var(--accent); }

.stat-num {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 600;
  color: var(--navy);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-lbl {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-400);
}

/* ── FILTER BAR ──────────────────────────────────────────────── */
.filter-bar {
  background: var(--card-bg);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.filter-group { display: flex; flex-direction: column; gap: 4px; }

.filter-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-400);
}

.filter-input {
  padding: 7px 10px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--navy);
  background: var(--white);
  transition: border-color 0.15s;
  min-width: 140px;
}

.filter-input:focus {
  outline: none;
  border-color: var(--blue);
}

.filter-group.grow { flex: 1; min-width: 180px; }

.btn-filter-clear {
  padding: 7px 14px;
  background: var(--gray-100);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--sans);
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-filter-clear:hover {
  background: var(--gray-200);
  border-color: var(--gray-400);
}

/* ── TABLE ───────────────────────────────────────────────────── */
.table-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

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

.data-table thead {
  background: var(--navy);
}

.data-table th {
  padding: 11px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.65);
  white-space: nowrap;
  border-bottom: 2px solid var(--blue);
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
  color: var(--navy);
  vertical-align: middle;
}

.data-table tbody tr {
  cursor: pointer;
  transition: background 0.12s;
}

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

.data-table tbody tr:hover td {
  background: rgba(30,95,216,0.04);
}

.td-id {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--gray-400);
  font-weight: 600;
}

.td-date {
  white-space: nowrap;
}

.dt-day {
  font-weight: 600;
  font-size: 12px;
}

.dt-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--gray-400);
}

.td-inspector {
  font-weight: 600;
}

.td-address {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mono-code {
  font-family: var(--mono);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.badge-code {
  background: rgba(10,22,40,0.07);
  color: var(--navy);
  font-family: var(--mono);
}

.badge-bad    { background: rgba(224,53,53,0.1);  color: var(--red); }
.badge-leave  { background: rgba(245,166,35,0.12); color: #8a5800; }
.badge-gated  { background: rgba(11,188,212,0.1);  color: #077080; }
.badge-dog    { background: rgba(224,123,0,0.1);   color: #8a4a00; }
.badge-child   { background: rgba(124,58,237,0.1);  color: #5b21b6; }
.badge-notres  { background: rgba(185,28,28,0.1);   color: #991b1b; }
.badge-photo  { background: var(--gray-100); color: var(--gray-600); border: 1px solid var(--gray-200); }

.td-arrow { color: var(--gray-400); font-size: 10px; }

.table-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--gray-400);
}

.table-empty i { font-size: 36px; margin-bottom: 10px; display: block; }

.table-footer {
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--gray-400);
  border-top: 1px solid var(--gray-100);
}

/* ── MODAL ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,22,40,0.6);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal-box {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  transform: translateY(-16px);
  transition: transform 0.2s;
  border: 1px solid var(--gray-200);
}

.modal-overlay.open .modal-box {
  transform: translateY(0);
}

.modal-head {
  background: var(--navy);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 2px solid var(--blue);
  flex-shrink: 0;
}

.modal-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex: 1;
  letter-spacing: 0.02em;
}

.modal-close {
  background: rgba(255,255,255,0.1);
  border: none;
  color: rgba(255,255,255,0.7);
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 16px;
}

.modal-close:hover { background: rgba(255,255,255,0.2); color: #fff; }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-foot {
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--gray-200);
  flex-shrink: 0;
}

/* ── DETAIL FIELDS ───────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.detail-field {
  background: var(--gray-100);
  border-radius: var(--radius);
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
}

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

.d-lbl {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-400);
  margin-bottom: 3px;
}

.d-val {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--navy);
  word-break: break-word;
}

.notes-box {
  background: rgba(245,166,35,0.06);
  border: 1px solid rgba(245,166,35,0.25);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--navy);
}

.notes-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

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

.photo-tile {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--gray-200);
}

.photo-tile-lbl {
  background: var(--gray-100);
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gray-600);
  border-bottom: 1px solid var(--gray-200);
}

.photo-tile img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  display: block;
}

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-danger {
  background: rgba(224,53,53,0.08);
  color: var(--red);
  border: 1px solid rgba(224,53,53,0.25);
}

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

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-600);
  border: 1px solid var(--gray-200);
}

.btn-secondary:hover {
  background: var(--gray-200);
}

/* ── INSPECTOR TABLE ─────────────────────────────────────────── */
.inspector-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-100);
}

.inspector-row:last-child { border-bottom: none; }

.ins-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy-light), var(--blue));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.ins-name { font-weight: 600; font-size: 13px; flex: 1; }
.ins-count { font-family: var(--mono); font-size: 12px; color: var(--gray-400); }

.ins-bar-wrap {
  width: 80px;
  height: 4px;
  background: var(--gray-200);
  border-radius: 2px;
  overflow: hidden;
}

.ins-bar-fill { height: 100%; background: var(--blue); border-radius: 2px; }

/* ── CHART AREA ──────────────────────────────────────────────── */
.chart-wrap {
  padding: 16px;
  height: 140px;
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}

.chart-bar {
  width: 100%;
  background: linear-gradient(180deg, var(--blue-bright), var(--blue));
  border-radius: 3px 3px 0 0;
  min-height: 3px;
  transition: height 0.5s cubic-bezier(0.34,1.56,0.64,1);
  position: relative;
}

.chart-bar:hover { filter: brightness(1.15); }

.chart-bar-val {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
}

.chart-lbl {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--gray-400);
  white-space: nowrap;
}

/* ── SPINNER ─────────────────────────────────────────────────── */
.spin {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(30,95,216,0.2);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-bar { gap: 8px; }
  .filter-group.grow { min-width: 100%; }
  .photos-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-field.full { grid-column: 1; }
  .data-table th:nth-child(5),
  .data-table td:nth-child(5),
  .data-table th:nth-child(6),
  .data-table td:nth-child(6) { display: none; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-box { border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 90vh; }
}

@media (max-width: 480px) {
  .reason-grid { grid-template-columns: 1fr; }
  .fields-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ═══════════════════════════════════════════════════════════════
   CALL STATUS BADGES — dashboard table
═══════════════════════════════════════════════════════════════ */
.cs-pending  { background: rgba(138,150,176,0.12); color: var(--gray-400); }
.cs-calling  { background: rgba(30,95,216,0.12);   color: var(--blue); }
.cs-answered { background: rgba(31,186,116,0.12);  color: #0d7a4e; }
.cs-voicemail{ background: rgba(245,166,35,0.12);  color: #8a5800; }
.cs-no_answer{ background: rgba(224,53,53,0.10);   color: var(--red); }
.cs-error    { background: rgba(224,53,53,0.10);   color: var(--red); }

/* Recording link in modal */
.recording-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: rgba(30,95,216,0.08);
  border: 1px solid rgba(30,95,216,0.2);
  border-radius: var(--radius);
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s;
}
.recording-link:hover { background: rgba(30,95,216,0.15); }

/* Call log inside modal */
.call-log { margin-top: 14px; }
.call-log-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-400);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.call-log-entry {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 6px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.call-log-type {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-600);
  flex-shrink: 0;
  min-width: 90px;
}
.call-log-phone { font-family: var(--mono); font-size: 12px; color: var(--navy); }
.call-log-meta  { font-size: 11px; color: var(--gray-400); }
.call-log-summary { font-size: 12px; color: var(--navy); font-style: italic; margin-top: 4px; width: 100%; }
