/* ═══════════════════════════════════════════════════════════
   משכנתאי — Professional Banking Dashboard
   Clean, modern fintech design — no emojis
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700;800&display=swap');

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

:root {
  /* Primary — Deep teal/navy (professional banking) */
  --primary-900: #0c2340;
  --primary-800: #0f3460;
  --primary-700: #1a4b7a;
  --primary-600: #1e6091;
  --primary-500: #2980b9;
  --primary-400: #5dade2;
  --primary-300: #85c1e9;
  --primary-200: #aed6f1;
  --primary-100: #d6eaf8;
  --primary-50: #eaf2f8;

  /* Accent — Warm gold (trust/premium) */
  --accent-600: #b8860b;
  --accent-500: #d4a017;
  --accent-400: #f0c040;
  --accent-300: #f7dc6f;
  --accent-200: #fdebd0;
  --accent-100: #fef9e7;

  /* Neutrals */
  --gray-50: #fafbfc;
  --gray-100: #f4f6f8;
  --gray-200: #e8ecf0;
  --gray-300: #d1d8e0;
  --gray-400: #99a6b5;
  --gray-500: #6b7c8f;
  --gray-600: #4a5a6a;
  --gray-700: #2d3a45;
  --gray-800: #1a252f;

  /* Status */
  --success-50: #f0fdf4;
  --success-100: #dcfce7;
  --success-500: #22c55e;
  --success-600: #16a34a;
  --success-700: #15803d;

  --warning-50: #fffbeb;
  --warning-100: #fef3c7;
  --warning-500: #f59e0b;
  --warning-600: #d97706;

  --danger-50: #fef2f2;
  --danger-100: #fee2e2;
  --danger-500: #ef4444;
  --danger-600: #dc2626;

  /* Surfaces */
  --surface-page: #f0f3f7;
  --surface-card: #ffffff;

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
  --shadow: 0 2px 8px rgba(0,0,0,.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.1);
}

/* ===== Base ===== */
body {
  font-family: 'Rubik', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--surface-page);
  min-height: 100vh;
  color: var(--gray-800);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ===== Layout ===== */
main {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 1.5rem auto;
  padding: 0 1.25rem;
}

main.login-page {
  max-width: 420px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
}

/* ===== Typography ===== */
h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-900);
  letter-spacing: -0.01em;
}
h2 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--gray-700);
}
h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-700);
}
.hint {
  color: var(--gray-400);
  font-size: 0.82rem;
  margin: 0.25rem 0;
}

/* ===== Page Header ===== */
.case-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 0.75rem;
  border: 1px solid var(--gray-200);
  border-top: 3px solid var(--primary-500);
}

/* ===== Back Link ===== */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--primary-500);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  transition: all .2s;
  background: var(--primary-50);
  border: 1px solid var(--primary-100);
  margin-bottom: 0.5rem;
}
.back-link:hover {
  color: var(--primary-700);
  background: var(--primary-100);
  border-color: var(--primary-200);
}

/* ===== Forms ===== */
input, select, textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  font-family: inherit;
  font-size: 0.85rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  background: #fff;
  color: var(--gray-800);
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-400);
  box-shadow: 0 0 0 3px rgba(41,128,185,.1);
}
input::placeholder { color: var(--gray-400); }

/* ===== Buttons ===== */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.25rem;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: white;
  background: var(--primary-600);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .15s;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
  text-decoration: none;
  white-space: nowrap;
}
button:hover {
  background: var(--primary-700);
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
button:active { transform: translateY(0); }
button:disabled {
  background: var(--gray-300);
  color: var(--gray-400);
  box-shadow: none;
  cursor: not-allowed;
}

.btn-secondary {
  background: white;
  color: var(--primary-600);
  border: 1px solid var(--primary-200);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
  background: var(--primary-50);
  border-color: var(--primary-300);
}

.btn-green, .btn-approve {
  background: var(--success-600);
}
.btn-green:hover, .btn-approve:hover {
  background: var(--success-700);
}

.btn-run {
  width: 100%;
  padding: 0.7rem 1.25rem;
  font-size: 0.95rem;
  background: var(--primary-700);
  border-radius: var(--radius);
}
.btn-run:hover {
  background: var(--primary-800);
}

.btn-next {
  background: var(--primary-600);
}

.btn-save {
  background: var(--primary-600);
  padding: 0.5rem 1.5rem;
}

.btn-view {
  padding: 4px 10px;
  border: 1px solid var(--primary-200);
  border-radius: var(--radius-xs);
  background: var(--primary-50);
  color: var(--primary-600);
  cursor: pointer;
  font-size: 0.78rem;
  box-shadow: none;
  font-weight: 600;
}
.btn-view:hover {
  background: var(--primary-100);
  border-color: var(--primary-300);
  box-shadow: none;
  transform: none;
}

.btn-close {
  background: none;
  border: none;
  color: var(--gray-400);
  font-size: 1.15rem;
  cursor: pointer;
  box-shadow: none;
  padding: 0.25rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
}
.btn-close:hover {
  color: var(--danger-500);
  background: var(--danger-50);
  box-shadow: none;
  transform: none;
}

/* ===== App Form ===== */
.app-form { font-size: 0.88rem; }
.form-sub {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary-700);
  margin: 1.25rem 0 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--primary-50);
  border-radius: var(--radius);
  border-right: 3px solid var(--primary-400);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.form-sub:first-child { margin-top: 0; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem 0.75rem;
  padding: 0.35rem 0;
}

.form-field label {
  display: block;
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--gray-500);
  margin-bottom: 2px;
  text-transform: none;
}

.form-save-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.save-msg { font-size: 0.82rem; font-weight: 500; }
.save-msg.ok { color: var(--success-600); }
.save-msg.err { color: var(--danger-500); }

.docs-section {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-200);
}

/* ===== Errors & Messages ===== */
.error { color: var(--danger-500); font-size: 0.88rem; margin-top: 0.5rem; }
.hidden { display: none !important; }

.error-banner {
  background: var(--danger-50);
  color: var(--danger-600);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  border-right: 3px solid var(--danger-500);
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ═══════════════════════════════════════════════
   STEPPER — Horizontal Progress Bar
   ═══════════════════════════════════════════════ */
.stepper {
  display: flex;
  align-items: flex-start;
  padding: 0.75rem 1.25rem;
  margin-bottom: 0.75rem;
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}

.step {
  flex: 1;
  text-align: center;
  position: relative;
  cursor: pointer;
  padding: 0.4rem 0.2rem 0.5rem;
  border-radius: var(--radius);
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}
.step:hover { background: var(--gray-100); }
.step.tab-active {
  border-bottom-color: var(--primary-500);
  background: var(--primary-50);
}

.step-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  margin: 0 auto 0.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.78rem;
  position: relative;
  z-index: 2;
  border: 2px solid var(--gray-300);
  background: white;
  color: var(--gray-400);
  transition: all 0.3s;
}

.step-label {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--gray-400);
  line-height: 1.2;
}

/* Done */
.step.done .step-num {
  border-color: var(--success-500);
  background: var(--success-500);
  color: white;
}
.step.done .step-label { color: var(--success-600); font-weight: 600; }

/* Active */
.step.active .step-num {
  border-color: var(--primary-500);
  background: var(--primary-500);
  color: white;
  box-shadow: 0 0 0 3px rgba(41,128,185,.15);
}
.step.active .step-label { color: var(--primary-600); font-weight: 600; }

/* Error */
.step.error .step-num {
  border-color: var(--danger-500);
  background: var(--danger-500);
  color: white;
}

/* Connector lines */
.step:not(:first-child)::before {
  content: '';
  position: absolute;
  top: calc(0.4rem + 15px);
  height: 2px;
  background: var(--gray-300);
  z-index: 1;
  right: calc(50% + 19px);
  left: calc(-50% + 19px);
  border-radius: 1px;
}
.step.done:not(:first-child)::before {
  background: var(--success-500);
}

/* ===== Tab Content ===== */
.tab-content {
  display: none;
  animation: fadeTab 0.25s ease;
}
.tab-content.visible { display: block; }
@keyframes fadeTab {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.tab-panel {
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}

.tab-panel h2 {
  font-size: 1rem;
  color: var(--primary-800);
  margin: 0 0 0.85rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ===== Status Badge ===== */
.status-badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: 99px;
  font-weight: 600;
  white-space: nowrap;
}
.status-draft { background: var(--gray-200); color: var(--gray-500); }
.status-scanning {
  background: var(--primary-100);
  color: var(--primary-600);
  animation: badgePulse 2s infinite;
}
.status-waiting_approval { background: var(--warning-100); color: var(--warning-600); }
.status-waiting_analysis { background: var(--primary-100); color: var(--primary-600); }
.status-done { background: var(--success-100); color: var(--success-600); }
@keyframes badgePulse { 0%,100% { opacity: 1; } 50% { opacity: .65; } }

/* ===== Upload Zone ===== */
.upload-zone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  margin: 0.75rem 0;
  cursor: pointer;
  transition: all .2s;
  background: var(--gray-50);
}
.upload-zone:hover {
  border-color: var(--primary-400);
  background: var(--primary-50);
}
.upload-zone.drag-over {
  border-color: var(--primary-500);
  background: var(--primary-100);
}
.upload-icon {
  font-size: 2rem;
  margin-bottom: 0.4rem;
  color: var(--gray-400);
}
.upload-zone p { color: var(--gray-500); font-size: 0.88rem; }

.upload-status { font-size: 0.85rem; margin: 0.5rem 0; font-weight: 500; }
.upload-status.success { color: var(--success-600); }
.upload-status.error { color: var(--danger-500); }

/* ===== File List ===== */
.file-grid {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.4rem;
}
.file-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius);
  background: var(--success-50);
  border: 1px solid var(--success-100);
  font-size: 0.82rem;
}
.file-row:hover { border-color: var(--success-500); }
.file-icon { font-size: 0.95rem; flex-shrink: 0; }
.file-name { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.no-files { color: var(--gray-400); font-size: 0.82rem; margin: 0.5rem 0; }

/* ═══════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════ */
.login-page { text-align: center; }

.login-card {
  background: var(--surface-card);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2.25rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200);
  position: relative;
  overflow: hidden;
}
.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-600), var(--primary-400));
}

.login-logo {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  background: var(--primary-700);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  box-shadow: 0 4px 12px rgba(12,35,64,.2);
}

.login-logo svg {
  width: 28px;
  height: 28px;
}

.login-page h1 {
  font-size: 1.45rem;
  margin-bottom: 0.15rem;
  color: var(--primary-900);
}

.login-page form {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.login-page input {
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
  border-radius: var(--radius);
  text-align: right;
}
.login-page button[type="submit"] {
  margin-top: 0.35rem;
  padding: 0.7rem;
  font-size: 0.95rem;
  border-radius: var(--radius);
  width: 100%;
}

/* ═══════════════════════════════════════════════
   CASES LIST
   ═══════════════════════════════════════════════ */
.case-list {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.case-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.25rem;
  background: var(--surface-card);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--gray-200);
  transition: all .15s;
  box-shadow: var(--shadow-xs);
}
.case-item:hover {
  border-color: var(--primary-300);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.case-item strong { color: var(--gray-800); font-weight: 600; }

.create-section {
  padding: 1.25rem 1.5rem;
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
  margin-bottom: 0.75rem;
}
.create-section h3 { margin-bottom: 0.75rem; }

/* ═══════════════════════════════════════════════
   SCAN PROGRESS (Tab 2)
   ═══════════════════════════════════════════════ */
.status-timeline {
  padding: 1.5rem;
  background: var(--primary-800);
  border-radius: var(--radius-lg);
  margin-bottom: 0.75rem;
}

.tl-header { text-align: center; margin-bottom: 1.25rem; }
.tl-header h3 { font-size: 1.05rem; color: white; font-weight: 600; }
.tl-header .hint { color: rgba(255,255,255,.5); }

.status-steps {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  margin-bottom: 1rem;
}
.status-step { flex: 1; text-align: center; position: relative; z-index: 2; }
.ss-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.4rem;
  font-size: 1rem;
  border: 2px solid rgba(255,255,255,.15);
  transition: all .3s;
}
.ss-green {
  background: var(--success-500) !important;
  color: white !important;
  border-color: var(--success-500) !important;
}
.ss-orange {
  background: var(--warning-500) !important;
  color: white !important;
  border-color: var(--warning-500) !important;
  animation: pulse 1.5s infinite;
}
.ss-label { font-size: 0.78rem; color: rgba(255,255,255,.55); font-weight: 500; }

.scan-progress {
  max-width: 300px;
  margin: 0 auto;
  height: 4px;
  background: rgba(255,255,255,.12);
  border-radius: 2px;
  overflow: hidden;
}
.scan-progress-bar {
  height: 100%;
  background: var(--primary-300);
  border-radius: 2px;
  animation: progress-indeterminate 1.5s ease-in-out infinite;
  width: 40%;
}

/* ===== Loading / Spinner ===== */
.loading-box { text-align: center; padding: 2.5rem 1.5rem; }
.spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 1rem;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary-500);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes progress-indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

.loading-text { font-weight: 600; font-size: 1rem; color: var(--gray-700); }
.loading-sub { color: var(--gray-400); margin-top: 0.3rem; font-size: 0.85rem; }

/* ===== Success / Error Circles ===== */
.success-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--success-500);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
  font-size: 1.6rem;
  animation: popIn 0.4s ease-out;
}
.error-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--danger-500);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
  font-size: 1.6rem;
}
@keyframes popIn {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}

.scan-done-text { font-size: 1.1rem; font-weight: 700; color: var(--success-600); margin-bottom: 0.4rem; }
.scan-error-text { font-size: 1.1rem; font-weight: 700; color: var(--danger-500); margin-bottom: 0.4rem; }

/* ===== Waiting Box ===== */
.waiting-box {
  text-align: center;
  padding: 2.5rem;
  color: var(--gray-400);
}
.waiting-icon {
  font-size: 2rem;
  margin-bottom: 0.4rem;
  opacity: 0.35;
  color: var(--gray-400);
}

/* ═══════════════════════════════════════════════
   APPROVE TAB (Tab 3) — Summary Cards
   ═══════════════════════════════════════════════ */
.appr-summary-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}
.appr-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 0.85rem 0.4rem;
  text-align: center;
  background: white;
  transition: all .15s;
}
.appr-card:hover { box-shadow: var(--shadow); }
.appr-card .val {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 0.05rem;
  line-height: 1;
}
.appr-card .lbl {
  font-size: 0.72rem;
  color: var(--gray-400);
  font-weight: 500;
}
.appr-card.total {
  border-color: var(--primary-200);
  background: var(--primary-50);
}
.appr-card.total .val { color: var(--primary-600); }
.appr-card.ok {
  border-color: var(--success-100);
  background: var(--success-50);
}
.appr-card.ok .val { color: var(--success-600); }
.appr-card.unknown {
  border-color: var(--warning-100);
  background: var(--warning-50);
}
.appr-card.unknown .val { color: var(--warning-600); }
.appr-card.warn {
  border-color: var(--danger-100);
  background: var(--danger-50);
}
.appr-card.warn .val { color: var(--danger-500); }

/* ===== Document Table ===== */
.docs-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.82rem;
  margin-bottom: 1.25rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--gray-200);
}
.docs-table th {
  background: var(--primary-800);
  color: white;
  text-align: right;
  padding: 0.6rem 0.75rem;
  font-weight: 600;
  font-size: 0.78rem;
  white-space: nowrap;
}
.docs-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
  background: white;
}
.docs-table tbody tr { transition: all .1s; }
.docs-table tbody tr:hover td { background: var(--primary-50); }
.docs-table tr.needs-review td {
  background: var(--warning-50);
}
.docs-table tr.needs-review td:first-child {
  border-right: 3px solid var(--warning-500);
}

.quality-bar-inline {
  display: inline-block;
  width: 60px;
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
  vertical-align: middle;
}
.qb-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.approve-bar {
  position: sticky;
  bottom: 0;
  background: white;
  border-top: 1px solid var(--gray-200);
  padding: 0.85rem;
  text-align: center;
  margin-top: 1rem;
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ===== Side Panel (modal overlay) ===== */
.side-panel {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: rgba(12,35,64,.3);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.side-panel .side-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.25rem;
  background: var(--gray-100);
  border-bottom: 1px solid var(--gray-200);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.side-panel .side-body {
  overflow-y: auto;
  padding: 1.25rem;
  direction: rtl;
  background: white;
  max-width: 580px;
  width: 90vw;
  max-height: 80vh;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.doc-text-preview pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.82rem;
  line-height: 1.65;
  background: var(--gray-50);
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  max-height: 380px;
  overflow-y: auto;
  font-family: 'Rubik', sans-serif;
}

/* ═══════════════════════════════════════════════
   RESULTS: Credit Report (Tab 4)
   ═══════════════════════════════════════════════ */

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}
.kpi-card {
  text-align: center;
  padding: 0.6rem 0.4rem;
  background: var(--gray-50);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
}
.kpi-value {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.1;
}
.kpi-label {
  font-size: 0.68rem;
  color: var(--gray-400);
  margin-top: 0.1rem;
  font-weight: 500;
}

/* Rating circle */
.rating-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}

/* Charts Container */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.chart-card {
  padding: 0.75rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: white;
}
.chart-card h4 {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 0.35rem;
}

/* Findings, Anomalies, etc. */
.report-section {
  margin-bottom: 0.75rem;
  background: var(--surface-card);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 0.5rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.report-section h3 {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.55rem;
  background: var(--gray-50);
  border-radius: var(--radius-xs);
  border-bottom: 1px solid var(--gray-100);
}
.section-icon { font-size: 0.9rem; }
.section-count {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--gray-400);
}
.findings-box { border-top: 3px solid var(--primary-400); }
.anomalies-box { border-top: 3px solid var(--warning-500); }
.missing-box { border-top: 3px solid var(--danger-400); }
.questions-box { border-top: 3px solid var(--teal-500, #14b8a6); }
.report-item {
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius);
  margin-bottom: 0.25rem;
  border: 1px solid;
}
.report-item .ri-title {
  font-weight: 600;
  font-size: 0.8rem;
  margin-bottom: 0.1rem;
}
.report-item .ri-detail {
  font-size: 0.75rem;
  color: var(--gray-600);
  line-height: 1.4;
}
.report-item.info {
  background: var(--primary-50);
  border-color: var(--primary-200);
}
.report-item.warning {
  background: var(--warning-50);
  border-color: var(--warning-100);
}
.report-item.critical {
  background: var(--danger-50);
  border-color: var(--danger-100);
}

.doc-chip {
  display: inline-block;
  font-size: 0.72rem;
  padding: 2px 6px;
  background: var(--gray-200);
  border-radius: var(--radius-xs);
  margin-left: 3px;
  color: var(--gray-600);
}

.missing-doc-chip {
  display: inline-block;
  padding: 3px 10px;
  background: var(--danger-50);
  color: var(--danger-600);
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  border: 1px solid var(--danger-100);
}

/* ═══════════════════════════════════════════════
   TAB 4: Two-column layout — Report + Chat Sidebar
   ═══════════════════════════════════════════════ */
.tab4-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 0.75rem;
  align-items: start;
}
.tab4-report {
  /* inherits .tab-panel styles */
  min-width: 0;
}

/* Chat Sidebar */
.tab4-chat {
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 200px);
  max-height: 650px;
  min-height: 400px;
  position: sticky;
  top: 1rem;
  overflow: hidden;
}

.chat-sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 0.85rem;
  background: var(--primary-800);
  color: white;
  font-size: 0.82rem;
  font-weight: 600;
  flex-shrink: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.chat-suggestions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
  flex-shrink: 0;
}

.chat-suggest-btn {
  padding: 3px 8px;
  border: 1px solid var(--gray-300);
  border-radius: 16px;
  background: #fff;
  color: var(--gray-600);
  font-size: 0.68rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  box-shadow: none;
  white-space: nowrap;
}
.chat-suggest-btn:hover {
  background: var(--primary-50);
  border-color: var(--primary-400);
  color: var(--primary-600);
  box-shadow: none;
  transform: none;
}

.chat-messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.chat-input-bar {
  display: flex;
  gap: 0.3rem;
  padding: 0.45rem 0.65rem;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
  flex-shrink: 0;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.chat-input-bar input {
  flex: 1;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-family: inherit;
}
.chat-input-bar button {
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  border-radius: var(--radius);
}

.chat-bubble {
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius);
  max-width: 90%;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-bubble.user {
  background: var(--primary-600);
  color: white;
  margin-left: auto;
  border-bottom-left-radius: 2px;
}
.chat-bubble.assistant {
  background: var(--gray-100);
  color: var(--gray-800);
  margin-right: auto;
  border-bottom-right-radius: 2px;
}

/* ═══════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .tab4-layout { grid-template-columns: 1fr 280px; }
}
@media (max-width: 900px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .charts-row { grid-template-columns: 1fr; }
  .appr-summary-cards { grid-template-columns: repeat(3, 1fr); }
  #report-details-grid, #report-extras-grid { grid-template-columns: 1fr !important; }
  .tab4-layout {
    grid-template-columns: 1fr;
  }
  .tab4-chat {
    position: static;
    height: auto;
    max-height: 400px;
    min-height: 280px;
  }
}
@media (max-width: 640px) {
  body { padding: 0.35rem; }
  main { margin: 0.5rem auto; padding: 0 0.65rem; }
  .stepper { overflow-x: auto; padding: 0.65rem; }
  .tab-panel { padding: 1rem; }
  .case-header { padding: 0.85rem 1rem; }
  .form-grid { grid-template-columns: 1fr; }
  .charts-row { grid-template-columns: 1fr; }
  .appr-summary-cards { grid-template-columns: repeat(2, 1fr); }
  #report-details-grid, #report-extras-grid { grid-template-columns: 1fr !important; }
  #report-header { flex-direction: column; text-align: center; }
  .tab4-chat { max-height: 350px; min-height: 250px; }
}
