* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f3f4f6;
  color: #111827;
  overflow: hidden;
}

.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 380px;
  background: #ffffff;
  padding: 22px;
  overflow-y: auto;
  border-right: 1px solid #e5e7eb;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.brand-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: #dc2626;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.brand h2 {
  margin: 0;
}
.brand p {
  margin: 4px 0 0;
  color: #6b7280;
  font-size: 13px;
}

.subtitle {
  color: #6b7280;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 14px;
}
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: bold;
  font-size: 13px;
}
.form-group input,
.form-group select {
  width: 100%;
  padding: 11px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  outline: none;
}
.form-group input:focus,
.form-group select:focus {
  border-color: #dc2626;
}

button {
  width: 100%;
  padding: 13px;
  background: #dc2626;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: bold;
  font-size: 14px;
}
button:hover {
  background: #b91c1c;
}
button:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.history-link {
  display: block;
  text-align: center;
  margin: 12px 0;
  color: #dc2626;
  text-decoration: none;
  font-weight: bold;
  font-size: 13px;
}

hr {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 20px 0;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#map {
  height: 56vh;
  width: 100%;
}

.result-panel {
  flex: 1;
  background: #ffffff;
  padding: 22px;
  overflow-y: auto;
  border-top: 1px solid #e5e7eb;
}

.result-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.result-header h2 {
  margin: 0;
}
.result-header span {
  color: #6b7280;
  font-size: 13px;
}

#result {
  line-height: 1.7;
  white-space: normal;
}

.summary-box {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  font-size: 14px;
}

.metric {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid #e5e7eb;
}
.metric:last-child {
  border-bottom: none;
}
.metric b {
  color: #dc2626;
}

.loading {
  margin-top: 12px;
  padding: 11px;
  background: #fff7ed;
  color: #9a3412;
  border-radius: 10px;
  font-size: 14px;
}
.hidden {
  display: none;
}

.error {
  color: #b91c1c;
  background: #fee2e2;
  padding: 13px;
  border-radius: 10px;
}

.info-box {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  padding: 13px;
  border-radius: 10px;
  color: #374151;
}

@media (max-width: 900px) {
  .app {
    flex-direction: column;
    overflow: auto;
    height: auto;
  }
  .sidebar {
    width: 100%;
  }
  #map {
    height: 420px;
  }
  body {
    overflow: auto;
  }
  .result-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.btn-secondary {
  display: inline-block;
  background: #111827;
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: bold;
  font-size: 13px;
}

.btn-secondary:hover {
  background: #374151;
}

#result h3 {
  margin: 20px 0 8px;
  color: #111827;
}

.chat-body {
  overflow: hidden;
  background: #f3f4f6;
}

.chat-layout {
  display: flex;
  height: 100vh;
}

.chat-sidebar {
  width: 360px;
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
  padding: 22px;
  overflow-y: auto;
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-header {
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  padding: 18px 22px;
}

.chat-header h2 {
  margin: 0 0 4px;
}

.chat-header p {
  margin: 0;
  color: #6b7280;
  font-size: 13px;
}

.small-label {
  display: block;
  font-weight: bold;
  font-size: 13px;
  margin: 20px 0 8px;
}

.chat-sidebar select {
  width: 100%;
  padding: 11px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
}

.quick-questions {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.quick-questions button {
  background: #f3f4f6;
  color: #111827;
  border: 1px solid #e5e7eb;
  text-align: left;
}

.quick-questions button:hover {
  background: #e5e7eb;
}

.chat-box {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
}

.bubble {
  max-width: 860px;
  padding: 13px 15px;
  border-radius: 16px;
  margin-bottom: 12px;
  line-height: 1.6;
  white-space: normal;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.bubble.system {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  color: #111827;
  margin-right: auto;
}

.bubble.user {
  background: #dc2626;
  color: #ffffff;
  margin-left: auto;
}

.chat-form {
  display: flex;
  gap: 10px;
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
  padding: 16px;
}

.chat-form input {
  flex: 1;
  padding: 13px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  outline: none;
}

.chat-form input:focus {
  border-color: #dc2626;
}

.chat-form button {
  width: 120px;
}

@media (max-width: 900px) {
  .chat-layout {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }
  .chat-sidebar {
    width: 100%;
  }
  .chat-main {
    min-height: 70vh;
  }
  .chat-form {
    position: sticky;
    bottom: 0;
  }
}

/* =========================
   MONOLITH DASHBOARD V2
   ========================= */
body.mono-dashboard {
  overflow: hidden;
  background: #f4f6fa;
  color: #0f172a;
}
body.modal-open {
  overflow: hidden;
}
.shell {
  display: grid;
  grid-template-columns: 310px 1fr;
  height: 100vh;
  overflow: hidden;
}
.dash-sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #fff7f7 100%);
  border-right: 1px solid #e5e7eb;
  padding: 22px 18px;
  overflow-y: auto;
  box-shadow: 10px 0 30px rgba(15, 23, 42, 0.04);
}
.brand-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px;
  border-radius: 22px;
  background: #fff;
  border: 1px solid #eef2f7;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.06);
  margin-bottom: 18px;
}
.brand-card h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
}
.brand-card p {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 12px;
}
.dash-menu {
  display: grid;
  gap: 9px;
}
.nav-item {
  width: 100%;
  border: 1px solid #eef2f7;
  background: rgba(255, 255, 255, 0.86);
  color: #111827;
  border-radius: 16px;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
  transition: 0.18s ease;
  text-align: left;
}
.nav-item:hover,
.nav-item.active {
  background: #dc2626;
  color: #fff;
  transform: translateX(3px);
  border-color: #dc2626;
}
.nav-item small {
  margin-left: auto;
  font-size: 10px;
  opacity: 0.75;
  background: rgba(255, 255, 255, 0.18);
  padding: 3px 7px;
  border-radius: 999px;
}
.nav-ico {
  width: 30px;
  height: 30px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: #fee2e2;
  color: #dc2626;
  flex: 0 0 auto;
}
.nav-item:hover .nav-ico,
.nav-item.active .nav-ico {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.nav-link {
  justify-content: flex-start;
}
.side-info {
  margin-top: 22px;
  padding: 16px;
  border-radius: 20px;
  background: #111827;
  color: #fff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}
.side-info span {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 999px;
  background: #dc2626;
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 9px;
}
.side-info b {
  display: block;
  font-size: 14px;
}
.side-info p {
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.5;
  margin: 8px 0 0;
}
.dash-main {
  overflow-y: auto;
  padding: 22px;
}
.topbar-modern {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #fff;
  border: 1px solid #eef2f7;
  border-radius: 24px;
  padding: 18px 20px;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.06);
  margin-bottom: 18px;
}
.eyebrow {
  margin: 0 0 5px;
  color: #dc2626;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.topbar-modern h2,
.section-head h2 {
  margin: 0;
  font-size: 24px;
}
.top-actions,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.section-head {
  margin-bottom: 16px;
}
.section-head p {
  margin: 4px 0 0;
  color: #64748b;
}
.ghost-btn,
.primary-mini,
.primary-btn,
.mini-btn,
.btn-excel {
  border: 0;
  border-radius: 14px;
  padding: 11px 14px;
  text-decoration: none;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}
.ghost-btn {
  background: #f8fafc;
  color: #111827;
  border: 1px solid #e5e7eb;
  width: auto;
}
.ghost-btn.small {
  padding: 9px 12px;
  font-size: 12px;
}
.primary-mini,
.primary-btn {
  background: #dc2626;
  color: #fff;
}
.primary-mini:hover,
.primary-btn:hover {
  background: #b91c1c;
}
.primary-btn {
  width: 100%;
}
.mini-btn {
  width: auto;
  background: #fee2e2;
  color: #b91c1c;
  padding: 8px 11px;
  font-size: 12px;
}
.mini-btn.dark {
  background: #111827;
  color: #fff;
}
.btn-excel {
  background: #157347;
  color: #fff;
}
.dash-section {
  display: none;
}
.active-section {
  display: block;
}
.analysis-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  align-items: stretch;
}
.card-soft,
.table-card-modern,
.filter-card-modern {
  background: #fff;
  border: 1px solid #eef2f7;
  border-radius: 24px;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.06);
}
.control-panel {
  padding: 18px;
}
.card-title-row h3,
.control-panel h4 {
  margin: 0 0 6px;
}
.card-title-row p {
  margin: 0 0 16px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.5;
}
.map-card {
  overflow: hidden;
  min-height: 480px;
}
.mono-dashboard #map {
  height: 100%;
  min-height: 480px;
  border-radius: 24px;
}
.result-panel-modern {
  margin-top: 16px;
  padding: 20px;
}
.result-panel-modern #result {
  line-height: 1.75;
}
.summary-box.compact {
  max-height: 285px;
  overflow: auto;
}
.stats-modern {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.mono-dashboard .stat-card {
  background: #fff;
  border-radius: 22px;
  padding: 20px;
  border: 1px solid #eef2f7;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.06);
}
.mono-dashboard .stat-card span {
  color: #64748b;
  font-weight: 900;
  font-size: 13px;
}
.mono-dashboard .stat-card h2 {
  margin: 8px 0 0;
  font-size: 34px;
  color: #dc2626;
}
.filter-card-modern {
  display: grid;
  grid-template-columns: 1.3fr 220px auto;
  gap: 10px;
  padding: 14px;
  margin-bottom: 16px;
}
.filter-card-modern input,
.filter-card-modern select,
.section-head select,
#popupAnalysisSelect {
  width: 100%;
  border: 1px solid #dbe3ef;
  background: #f8fafc;
  border-radius: 14px;
  padding: 12px;
  outline: none;
}
.table-card-modern {
  overflow: hidden;
}
.table-card-modern table {
  width: 100%;
  min-width: 1050px;
  border-collapse: collapse;
}
.table-card-modern th {
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 14px;
}
.table-card-modern td {
  padding: 14px;
  border-top: 1px solid #eef2f7;
  font-size: 13px;
  vertical-align: top;
}
.text-limit {
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}
.pill.red {
  background: #fee2e2;
  color: #b91c1c;
}
.pill.green {
  background: #dcfce7;
  color: #166534;
}
.pill.gray {
  background: #f1f5f9;
  color: #475569;
}
.inline-form {
  margin: 0;
}
.detail-box {
  padding: 20px;
  margin-top: 16px;
}
.analysis-readable {
  line-height: 1.75;
}
.map-store-card {
  height: calc(100vh - 170px);
  min-height: 520px;
  overflow: hidden;
}
#storeMap {
  height: 100%;
  width: 100%;
  border-radius: 24px;
}
.chat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  z-index: 5000;
  display: flex;
  justify-content: flex-end;
  backdrop-filter: blur(4px);
}
.chat-overlay.hidden {
  display: none;
}
.chat-drawer {
  width: min(640px, 96vw);
  height: 100vh;
  background: #f4f6fa;
  padding: 18px;
  box-shadow: -24px 0 60px rgba(15, 23, 42, 0.22);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: drawerIn 0.18s ease-out;
}
@keyframes drawerIn {
  from {
    transform: translateX(40px);
    opacity: 0.5;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border-radius: 22px;
  padding: 16px;
  border: 1px solid #eef2f7;
}
.drawer-head h2 {
  margin: 0;
}
.close-btn {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 0;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 26px;
  cursor: pointer;
}
.drawer-quick {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 0;
}
.drawer-quick button {
  background: #fff;
  border: 1px solid #e5e7eb;
  color: #111827;
  box-shadow: none;
  font-size: 13px;
  border-radius: 14px;
}
.drawer-chatbox {
  flex: 1;
  background: #fff;
  border: 1px solid #eef2f7;
  border-radius: 22px;
  padding: 16px;
}
.drawer-form {
  border: 1px solid #eef2f7;
  border-radius: 22px;
  padding: 12px;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.06);
}
.drawer-form input {
  border-radius: 14px;
}
.drawer-form button {
  border-radius: 14px;
  background: #dc2626;
}
.hidden {
  display: none !important;
}
@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }
  body.mono-dashboard {
    overflow: auto;
  }
  .dash-sidebar {
    position: static;
  }
  .dash-menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .analysis-grid {
    grid-template-columns: 1fr;
  }
  .dash-main {
    overflow: visible;
  }
}
@media (max-width: 720px) {
  .topbar-modern,
  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .filter-card-modern,
  .stats-modern {
    grid-template-columns: 1fr;
  }
  .drawer-quick {
    grid-template-columns: 1fr;
  }
  .dash-menu {
    grid-template-columns: 1fr;
  }
}

.dash-sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #fff5f5 100%);
  border-right: 1px solid #f0dada;
  box-shadow: 8px 0 30px rgba(15, 23, 42, 0.04);
}

.brand-card {
  background: #ffffff;
  border: 1px solid #f3d4d4;
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 14px 35px rgba(226, 35, 40, 0.08);
}

.brand-icon {
  background: linear-gradient(135deg, #e22328, #b91c1c);
  color: #ffffff;
  box-shadow: 0 10px 25px rgba(226, 35, 40, 0.35);
}

.dash-menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
}

.nav-item {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: #334155;
  padding: 12px 14px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: 0.2s ease;
}

.nav-item:hover {
  background: #ffffff;
  border-color: #f3d4d4;
  color: #e22328;
  transform: translateX(3px);
}

.nav-item.active {
  background: #e22328;
  color: #ffffff;
  box-shadow: 0 12px 25px rgba(226, 35, 40, 0.25);
}

.nav-ico {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: #fff1f1;
  color: #e22328;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 34px;
}

.nav-item.active .nav-ico {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.nav-ico svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-chat small {
  margin-left: auto;
  font-size: 10px;
  background: #fee2e2;
  color: #b91c1c;
  padding: 3px 7px;
  border-radius: 999px;
}

.nav-item.active small {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.status-action-btn.loading {
  opacity: 0.6;
  pointer-events: none;
}

.pill.green {
  background: #dcfce7;
  color: #166534;
}

.pill.gray {
  background: #f1f5f9;
  color: #475569;
}
/* =========================
   FIX TABLE SCROLL KANAN-KIRI
   TEMPEL PALING BAWAH style.css
   ========================= */

/* Dashboard utama tetap bisa scroll vertikal */
body.mono-dashboard {
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

/* Shell jangan memotong isi tabel */
.shell {
  overflow: visible !important;
}

/* Area konten kanan */
.dash-main {
  min-width: 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

/* Section tidak boleh memaksa lebar */
.dash-section {
  min-width: 0 !important;
}

/* Card tabel tetap rapi */
.table-card-modern {
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
}

/* INI YANG PALING PENTING */
.table-wrap {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  -webkit-overflow-scrolling: touch;
}

/* Tabel jangan mengecil paksa, supaya muncul scrollbar */
.table-wrap table {
  width: max-content !important;
  min-width: 1200px !important;
  border-collapse: collapse;
}

/* Khusus tabel history */
#historySection .table-wrap table {
  min-width: 1250px !important;
}

/* Khusus tabel dashboard toko, karena kolomnya lebih banyak */
#storeTable {
  min-width: 1450px !important;
}

/* Header dan isi tabel jangan turun ke bawah */
.table-wrap th,
.table-wrap td {
  white-space: nowrap !important;
}

/* Kolom lokasi tetap pendek dan titik-titik */
.text-limit {
  max-width: 420px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* Biar scrollbar bawah kelihatan */
.table-wrap::-webkit-scrollbar {
  height: 10px;
}

.table-wrap::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 999px;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.table-wrap::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* =========================
   SEARCH LOKASI MANUAL
   ========================= */

.search-location-box {
  display: grid;
  grid-template-columns: 1fr 86px;
  gap: 8px;
}

.search-location-box input {
  width: 100%;
}

.search-location-box button {
  width: 86px;
  padding: 11px 10px;
  border-radius: 12px;
  background: #dc2626;
  color: #ffffff;
  font-weight: 900;
}

.location-search-result {
  margin-top: 10px;
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.location-result-item {
  width: 100%;
  text-align: left;
  background: #ffffff;
  color: #111827;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: none;
}

.location-result-item:hover {
  background: #fff1f1;
  color: #b91c1c;
  border-color: #fecaca;
}

.location-result-item b {
  display: block;
  font-size: 13px;
  margin-bottom: 3px;
}

.location-result-item small {
  display: block;
  color: #64748b;
  line-height: 1.4;
  font-size: 11px;
}

.search-empty {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
}
.drawer-quick {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  max-height: 210px;
  overflow-y: auto;
  padding-right: 4px;
}

.drawer-quick button {
  min-height: 46px;
  line-height: 1.3;
}

.drawer-quick::-webkit-scrollbar {
  width: 8px;
}

.drawer-quick::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 999px;
}

.drawer-quick::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}
/* =========================
   FIX CHAT POPUP - JAWABAN KELIHATAN
   ========================= */

.chat-drawer {
  display: flex !important;
  flex-direction: column !important;
  height: 100vh !important;
  overflow: hidden !important;
}

/* Header jangan makan tempat terlalu besar */
.drawer-head {
  flex-shrink: 0;
}

/* Dropdown pilih analisa */
#popupAnalysisSelect {
  flex-shrink: 0;
}

/* Tombol cepat dibuat lebih pendek dan bisa scroll sendiri */
.drawer-quick {
  flex-shrink: 0;
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px !important;
  max-height: 150px !important;
  overflow-y: auto !important;
  padding-right: 4px;
}

.drawer-quick button {
  min-height: 40px !important;
  padding: 9px 12px !important;
  font-size: 13px !important;
  line-height: 1.2 !important;
}

/* Area jawaban chat dibuat besar */
.drawer-chatbox {
  flex: 1 1 auto !important;
  min-height: 280px !important;
  max-height: none !important;
  overflow-y: auto !important;
  padding: 16px !important;
}

/* Form input tetap di bawah */
.drawer-form {
  flex-shrink: 0 !important;
  position: sticky;
  bottom: 0;
  background: #ffffff;
  z-index: 5;
}

/* Bubble jawaban jangan kepotong */
.bubble {
  max-width: 100% !important;
  word-break: break-word;
}

/* Scrollbar tombol quick */
.drawer-quick::-webkit-scrollbar,
.drawer-chatbox::-webkit-scrollbar {
  width: 8px;
}

.drawer-quick::-webkit-scrollbar-track,
.drawer-chatbox::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 999px;
}

.drawer-quick::-webkit-scrollbar-thumb,
.drawer-chatbox::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}
/* =========================
   FIX CHAT POPUP MOBILE
   ========================= */

@media (max-width: 768px) {
  .chat-overlay {
    align-items: stretch !important;
    justify-content: stretch !important;
    background: #f4f6fa !important;
  }

  .chat-drawer {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    padding: 10px !important;
    border-radius: 0 !important;
    overflow: hidden !important;
  }

  .drawer-head {
    flex-shrink: 0 !important;
    padding: 12px !important;
    border-radius: 18px !important;
  }

  .drawer-head h2 {
    font-size: 20px !important;
  }

  .small-label {
    margin: 8px 0 6px !important;
    flex-shrink: 0 !important;
  }

  #popupAnalysisSelect {
    flex-shrink: 0 !important;
    height: 44px !important;
  }

  .drawer-quick {
    flex-shrink: 0 !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px !important;
    max-height: 96px !important;
    overflow-y: auto !important;
  }

  .drawer-quick button {
    min-height: 38px !important;
    padding: 8px 10px !important;
    font-size: 12px !important;
  }

  .drawer-chatbox {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    overflow-y: auto !important;
    padding: 12px !important;
    border-radius: 18px !important;
  }

  .drawer-form {
    flex-shrink: 0 !important;
    position: relative !important;
    bottom: auto !important;
    padding: 10px !important;
    border-radius: 18px !important;
    display: grid !important;
    grid-template-columns: 1fr 88px !important;
    gap: 8px !important;
  }

  .drawer-form input {
    min-width: 0 !important;
    height: 46px !important;
    font-size: 14px !important;
  }

  .drawer-form button {
    width: 88px !important;
    height: 46px !important;
    padding: 0 !important;
  }

  .bubble {
    font-size: 14px !important;
    line-height: 1.55 !important;
    padding: 11px 12px !important;
    margin-bottom: 10px !important;
  }
}
/* =========================
   CHAT THINKING EFFECT
   ========================= */

.thinking-bubble {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #64748b;
  font-size: 13px;
}

.thinking-dot {
  width: 7px;
  height: 7px;
  background: #e22328;
  border-radius: 50%;
  display: inline-block;
  animation: thinkingPulse 1s infinite ease-in-out;
}

.thinking-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.thinking-dot:nth-child(3) {
  animation-delay: 0.3s;
}

.thinking-text {
  margin-left: 6px;
}

@keyframes thinkingPulse {
  0%,
  80%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-4px);
  }
}
