/* Custom Model Picker di Sebelah Tombol Gambar (Drop-Up & Anti-Melebar) */
.model-picker {
  position: static;
  min-width: 0;
}

.model-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  max-width: 100%;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 9px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-primary);
  transition: border-color 0.15s ease, background 0.15s ease;
  user-select: none;
}

.model-trigger:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.family-pill {
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.selected-model-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tier-badge {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--tier-bg);
  border: 1px solid var(--tier-border);
  color: var(--tier-text);
  text-transform: uppercase;
  flex-shrink: 0;
}

.vision-badge {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}

.chevron-icon {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.18s ease;
}

.model-picker.open .chevron-icon {
  transform: rotate(180deg);
}

/* Dropdown Membuka ke Atas & Sejajar Lebar Composer */
.model-dropdown {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  width: 390px;
  max-width: 100%;
  max-height: min(420px, 60dvh);
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: none;
  z-index: 40;
}

.model-picker.open .model-dropdown {
  display: block;
}

.family-group {
  margin-bottom: 8px;
}

.family-group:last-child {
  margin-bottom: 0;
}

.family-group-header {
  padding: 6px 10px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.model-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease;
}

.model-option:hover {
  background: var(--bg-app);
}

.model-option.selected {
  background: var(--accent-soft);
  border-color: rgba(34, 76, 61, 0.2);
}

.model-option-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-option-tags {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.cap-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.cap-tag.vision {
  background: #EDF4F1;
  color: var(--accent);
}

.cap-tag.text-only {
  background: #F1EFEA;
  color: var(--text-muted);
}

/* Badge Kuota High Tier & Kuota Vision (Foto) */
.quota-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 99px;
  background: var(--tier-bg);
  border: 1px solid var(--tier-border);
  font-size: 11px;
  color: var(--tier-text);
  font-weight: 500;
  white-space: nowrap;
}

.quota-pill.vision-quota {
  background: var(--accent-soft);
  border-color: rgba(34, 76, 61, 0.25);
  color: var(--accent);
}

.quota-pill.exhausted {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
}

.quota-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.quota-timer {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  padding-left: 6px;
  border-left: 1px solid currentColor;
  opacity: 0.85;
}

/* Empty State */
.empty-state {
  margin: 5vh auto 0;
  max-width: 560px;
}

.empty-state h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 22px;
}

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.prompt-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.prompt-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.prompt-card strong {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.prompt-card span {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.4;
  display: block;
}

/* Messages & Image Attachments */
.message-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.message-row.user {
  justify-content: flex-end;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  margin-top: 2px;
}

.avatar.assistant {
  background: var(--accent);
  color: #FFFFFF;
}

.user-message-stack {
  max-width: 85%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.message-images {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.message-images img {
  max-width: 220px;
  max-height: 180px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  object-fit: cover;
  box-shadow: var(--shadow-sm);
}

.bubble {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--text-primary);
  word-break: break-word;
}

.message-row.user .bubble {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 11px 15px;
  border-radius: 14px 14px 4px 14px;
  box-shadow: var(--shadow-sm);
  white-space: pre-wrap;
}

.message-row.assistant .bubble {
  flex: 1;
  min-width: 0;
  padding-top: 2px;
}

.assistant-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.bubble p {
  margin-bottom: 12px;
}

.bubble p:last-child {
  margin-bottom: 0;
}

.bubble code.inline-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  background: #ECEAE3;
  padding: 2px 6px;
  border-radius: 5px;
  color: #1F3A30;
}

.code-block {
  margin: 14px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #1E1E1C;
  color: #F3F2EE;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: #282825;
  border-bottom: 1px solid #353531;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: #A8A59C;
}

.copy-btn {
  background: transparent;
  border: 1px solid #454540;
  color: #E5E3DC;
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 5px;
  cursor: pointer;
}

.copy-btn:hover {
  background: #383834;
}

.code-block pre {
  padding: 14px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.55;
}

.error-banner {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
}

/* Error Handler Box di Atas Input */
.error-log-box {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  font-size: 12px;
  line-height: 1.45;
}

.error-log-box[hidden] {
  display: none;
}

.error-log-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  word-break: break-word;
}

.error-log-content strong {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.error-log-content span {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
}

.error-log-close {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
}

/* Composer & Toolbar Bawah */
.composer-box {
  max-width: 780px;
  margin: 0 auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  box-shadow: var(--shadow-md);
  transition: border-color 0.15s ease;
}

.composer-box:focus-within {
  border-color: var(--accent);
}

.composer-box.drag-over {
  border-color: var(--accent);
  background: #F4F9F6;
}

.attachment-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid #F1EFEA;
}

.attachment-bar[hidden] {
  display: none;
}

.attachment-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-strong);
}

.attachment-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.remove-attachment {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(28, 27, 24, 0.78);
  color: #FFFFFF;
  font-size: 12px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.vision-warning {
  background: var(--tier-bg);
  border: 1px solid var(--tier-border);
  color: var(--tier-text);
  font-size: 12px;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

.vision-warning[hidden] {
  display: none;
}

.composer-box textarea {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text-primary);
  background: transparent;
  max-height: 180px;
  min-height: 24px;
}

.composer-box textarea::placeholder {
  color: var(--text-muted);
}

.composer-footer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #F1EFEA;
  gap: 8px;
}

.composer-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.attach-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-app);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  user-select: none;
  transition: all 0.15s ease;
}

.attach-btn:hover:not(.disabled) {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.attach-btn.disabled {
  opacity: 0.48;
  cursor: not-allowed;
  background: #F3F1EC;
  color: var(--text-muted);
}

.send-btn {
  background: var(--accent);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-sm);
  height: 32px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.send-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Modal Pengaturan */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 27, 24, 0.35);
  display: none;
  place-items: center;
  z-index: 50;
  padding: 16px;
}

.modal-backdrop.open {
  display: grid;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 460px;
  padding: 22px;
  box-shadow: var(--shadow-md);
}

.modal h2 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 4px;
}

.modal p.sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 18px;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.field input,
.field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
  background: #FCFBF9;
}

.field textarea {
  font-family: inherit;
  resize: vertical;
  min-height: 72px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.btn-secondary {
  padding: 0 14px;
  height: 32px;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
}

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

  .attach-btn {
    padding: 0 9px;
  }

  #attachBtnLabel {
    display: none;
  }

  .vision-badge {
    display: none;
  }

  .quota-pill {
    padding: 3px 7px;
    font-size: 10px;
    gap: 5px;
  }

  .quota-timer {
    font-size: 9.5px;
    padding-left: 5px;
  }
}

/* Pill Login di Topbar & Banner Kunci High Tier */
.guest-login-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 99px;
  background: var(--accent);
  color: #FFFFFF;
  text-decoration: none;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

.guest-login-pill[hidden],
.quota-pill[hidden] {
  display: none;
}

.guest-login-pill:hover {
  background: var(--accent-hover);
}

.auth-lock-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--tier-bg);
  border: 1px solid var(--tier-border);
  color: var(--tier-text);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  font-size: 12px;
  line-height: 1.4;
}

.auth-lock-banner[hidden] {
  display: none;
}

.auth-lock-link {
  background: var(--accent);
  color: #FFFFFF;
  text-decoration: none;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.auth-lock-link:hover {
  background: var(--accent-hover);
}

/* =========================================================
   PATCH CSS KOMPONEN TERBARU VANZZAI (MOBILE & DESKTOP)
   ========================================================= */

/* 1. Layar Pembuka (Empty Welcome) */
.empty-welcome {
  min-height: 54dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 16px;
  margin: auto;
}

.welcome-mark {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--accent, #224C3D);
  color: #FFFFFF;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 14px;
  box-shadow: 0 4px 12px rgba(34, 76, 61, 0.18);
}

.empty-welcome h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary, #1C1B18);
  margin-bottom: 6px;
}

.empty-welcome p {
  max-width: 340px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-secondary, #5C5A54);
}

/* 2. Pratinjau Gambar Lampiran di Composer */
.attachment-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border, #E3E0D8);
}

.attachment-bar[hidden] {
  display: none !important;
}

.attachment-chip {
  position: relative;
  width: 66px;
  height: 66px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-strong, #CFCBC0);
  background: var(--bg-app, #F7F6F2);
  flex-shrink: 0;
}

.attachment-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.remove-attach-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 99px;
  border: none;
  background: rgba(28, 27, 24, 0.78);
  color: #FFFFFF;
  font-size: 13px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
}

/* 3. Perbaikan Bar Bawah & Tombol Kirim Agar Tidak Terjepit di HP */
.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.composer-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.attach-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.model-picker {
  position: relative;
  min-width: 0;
  flex: 1;
  max-width: fit-content;
}

.model-trigger {
  max-width: 100%;
  overflow: hidden;
}

.selected-model-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 115px;
}

@media (min-width: 480px) {
  .selected-model-name {
    max-width: 200px;
  }
}

.send-btn {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 0 14px;
}

/* 4. Dropdown Pemilih Model */
.model-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: min(300px, 84vw);
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg-surface, #FFFFFF);
  border: 1px solid var(--border-strong, #CFCBC0);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 10px 28px rgba(28, 27, 24, 0.14);
  z-index: 60;
  display: none;
}

.model-dropdown.open {
  display: block;
}

.model-group-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #8C8980);
  padding: 8px 9px 4px;
}

.model-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 9px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-primary, #1C1B18);
  font-family: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}

.model-option:hover,
.model-option.active {
  background: var(--accent-soft, #E8F0EC);
  color: var(--accent, #224C3D);
}

.model-option-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.model-option-badges {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* 5. Gelembung Percakapan & Gambar di Riwayat Chat */
.message-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  align-items: flex-start;
}

.message-row.user {
  justify-content: flex-end;
}

.ai-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent, #224C3D);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 600;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.message-bubble {
  max-width: 85%;
  border-radius: 14px;
  padding: 11px 14px;
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}

.user-bubble {
  background: var(--bg-surface, #FFFFFF);
  border: 1px solid var(--border, #E3E0D8);
  color: var(--text-primary, #1C1B18);
}

.ai-bubble {
  background: transparent;
  padding: 2px 4px;
  color: var(--text-primary, #1C1B18);
  max-width: calc(100% - 38px);
}

.msg-model-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted, #8C8980);
  margin-bottom: 4px;
}

.msg-images {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.msg-images img {
  max-width: 210px;
  max-height: 210px;
  width: auto;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--border, #E3E0D8);
  object-fit: cover;
  display: block;
}

.code-block {
  background: #1E1E1C;
  color: #F3F2EE;
  padding: 10px 12px;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  overflow-x: auto;
  margin: 8px 0;
}

.message-text code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  background: rgba(28, 27, 24, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
}

.code-block code {
  background: transparent;
  padding: 0;
}

/* 6. Riwayat Kosong di Sidebar */
.history-empty {
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--text-muted, #8C8980);
}

/* =========================================================
   PERBAIKAN TOMBOL HAPUS RIWAYAT & TOPBAR MOBILE
   ========================================================= */

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px 9px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.history-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
}

.delete-history-btn {
  width: 24px;
  height: 24px;
  min-width: 24px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted, #8C8980);
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.delete-history-btn:hover {
  background: rgba(180, 60, 60, 0.12);
  color: #B43C3C;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.quota-pill {
  white-space: nowrap;
}

/* =========================================================
   FITUR EDIT PESAN USER
   ========================================================= */

.user-msg-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  max-width: 85%;
}

.user-msg-stack .user-bubble {
  max-width: 100%;
}

.msg-edit-trigger {
  background: transparent;
  border: none;
  padding: 2px 6px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 11.5px;
  color: var(--text-muted, #8C8980);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.msg-edit-trigger:hover {
  background: rgba(28, 27, 24, 0.06);
  color: var(--text-primary, #1C1B18);
}

.editing-bubble {
  width: min(460px, 88vw);
  max-width: 100%;
  border-color: var(--accent, #224C3D);
}

.edit-msg-textarea {
  width: 100%;
  min-height: 64px;
  padding: 8px 10px;
  border: 1px solid var(--border-strong, #CFCBC0);
  border-radius: 10px;
  background: var(--bg-app, #F7F6F2);
  color: var(--text-primary, #1C1B18);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.5;
  resize: vertical;
}

.edit-msg-textarea:focus {
  outline: none;
  border-color: var(--accent, #224C3D);
  background: #FFFFFF;
}

.edit-msg-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.btn-edit-cancel,
.btn-edit-save {
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.btn-edit-cancel {
  background: var(--bg-app, #F7F6F2);
  color: var(--text-secondary, #5C5A54);
  border: 1px solid var(--border-strong, #CFCBC0);
}

.btn-edit-save {
  background: var(--accent, #224C3D);
  color: #FFFFFF;
  border: none;
}

.btn-edit-save:hover {
  background: var(--accent-hover, #193A2E);
}
