/* AI Chat Panel for Awan Notes — Precision & Responsive Styling */
.ai-internet-toggle:disabled { opacity: .45; cursor: not-allowed; }
.ai-input-toolbar-left { flex-wrap: wrap; }
.ai-helper-settings-link { display: flex; align-items: center; gap: 6px; width: 100%; min-width: 0; height: 26px; padding: 3px 5px; margin-bottom: 4px; background: transparent; border: 0; border-radius: 5px; color: #9fb2cc; font-size: 11px; text-align: left; cursor: pointer; }
.ai-helper-settings-link span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-helper-settings-link svg { width: 13px; height: 13px; flex-shrink: 0; }
.ai-helper-settings-link:hover { background: #ffffff08; color: #c5dcfa; }
.ai-helper-settings-link:focus-visible { outline: 2px solid #7db5ff; outline-offset: 2px; }

.ai-chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  background: #222c3c;
  color: #c4cfdf;
}

/* Minimalist Top Toolbar */
.ai-chat-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: #1e2837;
  flex-shrink: 0;
  min-width: 0;
}

.ai-model-picker {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  background: #182230;
  border: 1px solid #334661;
  color: #9bc0ea;
  font-size: 11px;
  font-weight: 500;
  flex: 1;
  min-width: 0;
  max-width: 165px;
  position: relative;
  transition: all 0.15s ease;
  cursor: pointer;
}

.ai-model-picker:hover,
.ai-model-picker:focus-within {
  background: #223044;
  border-color: #4b6b96;
  color: #c7defa;
}

.ai-model-picker svg {
  width: 12px;
  height: 12px;
  color: #7cb2f3;
  flex-shrink: 0;
}

.ai-model-select {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  color: inherit;
  font-size: 11px;
  font-family: inherit;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  padding: 0 14px 0 0;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.ai-model-select option,
.ai-model-select optgroup {
  background: #182230;
  color: #d1d9e6;
}

/* Custom subtle dropdown arrow inside picker */
.ai-model-picker::after {
  content: "";
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-top: 4px solid #6b85a6;
  pointer-events: none;
}

.ai-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.ai-chat-toolbar .icon-button {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  color: #8499b4;
  background: transparent;
  border: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: all 0.15s ease;
  padding: 0;
}

.ai-chat-toolbar .icon-button:hover {
  color: #c3dbff;
  background: rgba(255, 255, 255, 0.08);
}

.ai-chat-toolbar .icon-button.is-active {
  color: #8ec3ff;
  background: rgba(124, 178, 243, 0.18);
  box-shadow: inset 0 0 0 1px rgba(124, 178, 243, 0.35);
}

.ai-chat-toolbar .icon-button svg {
  width: 14px;
  height: 14px;
}

.ai-icon-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  min-width: 12px;
  height: 12px;
  line-height: 12px;
  padding: 0 2px;
  border-radius: 6px;
  background: #2b5484;
  color: #d7e8ff;
  font-size: 8px;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
}

/* Warning & Error Banners */
.ai-no-key-banner {
  margin: 10px 12px;
  padding: 10px 12px;
  border-radius: 7px;
  background: rgba(202, 138, 4, 0.12);
  border: 1px solid rgba(202, 138, 4, 0.28);
  color: #fef08a;
  font-size: 11px;
  line-height: 1.5;
}

.ai-no-key-banner p {
  margin: 0 0 6px;
}

.ai-no-key-banner button {
  background: #926507;
  color: #ffffff;
  border: 0;
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 10.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.ai-no-key-banner button:hover {
  background: #b47c0a;
}

.ai-error-banner {
  margin: 8px 12px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.28);
  color: #fca5a5;
  font-size: 10.5px;
  line-height: 1.4;
}

/* Chat Message List */
.ai-message-list {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: #3b4e69 transparent;
}

.ai-empty-greeting {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 22px 8px;
  color: #8195b0;
  gap: 8px;
}

.ai-empty-greeting svg {
  width: 28px;
  height: 28px;
  color: #7da5d9;
  opacity: 0.9;
}

.ai-empty-greeting h4 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: #e1ebf8;
}

.ai-empty-greeting p {
  margin: 0;
  font-size: 10.5px;
  line-height: 1.55;
  max-width: 210px;
  color: #8195b0;
}

.ai-quick-prompts {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  margin-top: 10px;
}

.ai-quick-prompt-btn {
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border-radius: 6px;
  background: #1c2635;
  border: 1px solid #33455f;
  color: #9bbfe8;
  font-size: 10.5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ai-quick-prompt-btn:hover {
  background: #27384e;
  border-color: #48648b;
  color: #d6e8fd;
}

/* Message Bubbles */
.ai-message {
  display: flex;
  flex-direction: column;
  font-size: 11.5px;
  line-height: 1.55;
  border-radius: 8px;
  padding: 8px 11px;
  word-break: break-word;
}

.ai-message.user {
  align-self: flex-end;
  max-width: 88%;
  background: #2f598b;
  color: #ffffff;
  border-bottom-right-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.ai-message.assistant {
  align-self: flex-start;
  max-width: 95%;
  background: #1c2635;
  border: 1px solid #33445c;
  color: #d2dfef;
  border-bottom-left-radius: 2px;
}

/* AI Action Chip (Interaksi alat: open, create, edit, delete note) */
.ai-action-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  margin-bottom: 6px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  max-width: 100%;
}

.ai-action-chip svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.ai-action-chip .ai-chip-label {
  opacity: 0.85;
}

.ai-action-chip .ai-chip-target {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-action-chip .ai-chip-arrow {
  margin-left: 2px;
  font-size: 10px;
  opacity: 0.6;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.ai-action-chip:hover .ai-chip-arrow {
  opacity: 1;
  transform: translate(1px, -1px);
}

.ai-action-chip.open {
  background: #172c44;
  border: 1px solid #2a578a;
  color: #9ec9ff;
}

.ai-action-chip.open:hover {
  background: #1f3b5c;
  border-color: #3b73b5;
  color: #ffffff;
}

.ai-action-chip.create {
  background: #153228;
  border: 1px solid #28634f;
  color: #85e8ba;
}

.ai-action-chip.create:hover {
  background: #1c4235;
  border-color: #36856a;
  color: #ffffff;
}

.ai-action-chip.edit {
  background: #332819;
  border: 1px solid #6c522a;
  color: #f7cd88;
}

.ai-action-chip.edit:hover {
  background: #443521;
  border-color: #8f6c38;
  color: #ffffff;
}

.ai-action-chip.delete {
  background: #331c21;
  border: 1px solid #692d37;
  color: #fca5a5;
  cursor: default;
}

.ai-action-chip.search {
  background: #241c3a;
  border: 1px solid #5a428c;
  color: #c4b5fd;
  cursor: default;
}

.ai-web-result-details {
  background: #141b24;
  border: 1px solid #2a374a;
  border-radius: 6px;
  padding: 6px 10px;
  margin: 4px 0 8px 0;
  font-size: 11px;
}

.ai-web-result-details summary {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: #9cbfe8;
  font-weight: 550;
  user-select: none;
}

.ai-web-result-details summary svg {
  width: 12px;
  height: 12px;
  color: #c4b5fd;
}

.ai-web-result-content {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #1f2b3b;
  color: #b5c7de;
  font-size: 11px;
  line-height: 1.5;
  max-height: 240px;
  overflow-y: auto;
}

.ai-message-text {
  font-size: 11.5px;
  line-height: 1.6;
  color: inherit;
  word-break: break-word;
}

.ai-message-text p {
  margin: 4px 0;
}

.ai-message-text p:first-child {
  margin-top: 0;
}

.ai-message-text p:last-child {
  margin-bottom: 0;
}

.ai-message-text h1,
.ai-message-text h2,
.ai-message-text h3,
.ai-message-text h4,
.ai-message-text h5,
.ai-message-text h6 {
  color: #e2ecf8;
  font-weight: 650;
  margin: 10px 0 4px;
  line-height: 1.35;
}

.ai-message-text h1:first-child,
.ai-message-text h2:first-child,
.ai-message-text h3:first-child,
.ai-message-text h4:first-child {
  margin-top: 0;
}

.ai-message-text h1 { font-size: 14.5px; }
.ai-message-text h2 { font-size: 13.5px; }
.ai-message-text h3 { font-size: 12.5px; }
.ai-message-text h4,
.ai-message-text h5,
.ai-message-text h6 { font-size: 11.5px; }

.ai-message-text strong {
  color: #f0f5fc;
  font-weight: 650;
}

.ai-message-text em {
  font-style: italic;
  color: #ccdced;
}

.ai-message-text ul,
.ai-message-text ol {
  margin: 4px 0 6px;
  padding-left: 18px;
}

.ai-message-text li {
  margin: 2px 0;
  padding-left: 2px;
}

.ai-message-text blockquote {
  border-left: 3px solid #3c5b88;
  padding: 4px 0 4px 10px;
  margin: 8px 0;
  color: #9db2cc;
  font-style: italic;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 0 4px 4px 0;
}

.ai-message-text code {
  font-family: Consolas, monospace;
  background: #233144;
  color: #9ec5f7;
  padding: 1.5px 5px;
  border-radius: 4px;
  font-size: 10.5px;
}

.ai-message-text .code-block-host {
  margin: 6px 0;
}

.ai-message-text a {
  color: #72a8f4;
  text-decoration: underline;
}

.ai-message-text a:hover {
  color: #a4c9ff;
}

.ai-message-text .wikilink {
  color: #85b4ff;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px dashed #528ae0;
  cursor: pointer;
}

.ai-message-text .wikilink:hover {
  color: #b9d6ff;
  border-bottom-style: solid;
}

.ai-message-text .note-tag {
  background: #263850;
  color: #91bbfc;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
}

.ai-message-text hr {
  border: 0;
  border-top: 1px solid #2e415b;
  margin: 10px 0;
}

.ai-message-text .paragraph-gap {
  height: 6px;
}

.ai-message-text .markdown-table {
  overflow-x: auto;
  margin: 8px 0;
}

.ai-message-text table {
  border-collapse: collapse;
  width: 100%;
  font-size: 11px;
}

.ai-message-text th,
.ai-message-text td {
  border: 1px solid #2e415b;
  padding: 5px 8px;
  text-align: left;
}

.ai-message-text th {
  background: #172232;
  color: #c9dbf1;
  font-weight: 600;
}

.ai-message-text .preview-task {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ai-message.user .ai-message-text strong {
  color: #ffffff;
}

.ai-message.user .ai-message-text code {
  background: rgba(0, 0, 0, 0.25);
  color: #d8eaff;
}

.ai-message.user .ai-message-text a {
  color: #d0e4ff;
}

.ai-message-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.ai-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 0;
  color: #7a91ad;
  font-size: 9.5px;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.ai-action-btn:hover {
  color: #c0d8f6;
  background: rgba(255, 255, 255, 0.06);
}

.ai-action-btn svg {
  width: 11px;
  height: 11px;
}

.ai-message pre {
  margin: 6px 0;
  padding: 7px 9px;
  background: #131b26;
  border: 1px solid #233144;
  border-radius: 6px;
  overflow-x: auto;
  font-family: Consolas, monospace;
  font-size: 10.5px;
}

.ai-message code {
  font-family: Consolas, monospace;
  background: #243244;
  color: #a5c9f3;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 10.5px;
}

/* Typing Indicator */
.ai-typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
}

.ai-typing-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #8aa1be;
  animation: ai-pulse 1.4s infinite ease-in-out both;
}

.ai-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.ai-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes ai-pulse {
  0%, 80%, 100% { transform: scale(0); opacity: 0.35; }
  40% { transform: scale(1); opacity: 1; }
}

/* Input Form Area */
.ai-input-form {
  display: flex;
  flex-direction: column;
  padding: 6px 10px 10px;
  gap: 6px;
  background: #1e2837;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
  min-width: 0;
}

/* Bottom Toolbar (Menampung kontrol konteks & alat di atas kotak ketik) */
.ai-input-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.ai-input-toolbar-left {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.ai-input-toolbar-right {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

/* Workspace Context Pill Button in bottom toolbar */
.ai-context-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid #334661;
  background: #182230;
  color: #8da9ce;
  font-size: 9.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-context-pill:hover {
  background: #24354c;
  color: #cce0f9;
  border-color: #49678f;
}

.ai-context-pill.is-active {
  background: #173250;
  border-color: #3b6b9e;
  color: #8ec3ff;
}

.ai-context-pill svg {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}

.ai-context-pill-check {
  font-size: 9px;
  color: #38bdf8;
  font-weight: 700;
  margin-left: 2px;
}

/* Active open note pill in bottom toolbar */
.ai-open-note-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #7b94b2;
  font-size: 9px;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-open-note-pill svg {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  color: #5c7ba2;
}

/* Small tool buttons in bottom toolbar */
.ai-bottom-tool-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: transparent;
  border: 0;
  color: #7187a4;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
}

.ai-bottom-tool-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #c2d8f5;
}

.ai-bottom-tool-btn.is-active {
  background: rgba(124, 178, 243, 0.18);
  color: #8ec3ff;
}

.ai-bottom-tool-btn svg {
  width: 13px;
  height: 13px;
}

.ai-input-box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  background: #192433;
  padding: 6px 8px 6px 12px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  min-width: 0;
  position: relative;
}

.ai-input-box:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.ai-input-box:focus-within {
  border-color: #5587cb;
  background: #1a2738;
  box-shadow: 0 0 0 1.5px rgba(85, 135, 203, 0.35);
}

.ai-textarea,
.ai-textarea:focus,
.ai-textarea:focus-visible {
  flex: 1;
  min-width: 0;
  height: 22px;
  min-height: 22px;
  max-height: 25vh;
  resize: none;
  background: transparent !important;
  border: 0 !important;
  outline: none !important;
  outline-offset: 0 !important;
  box-shadow: none !important;
  color: #e4effb;
  font-size: 12px;
  line-height: 20px;
  padding: 1px 0 2px;
  margin: 0;
  font-family: inherit;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #3e5576 transparent;
  box-sizing: border-box;
}

.ai-textarea::-webkit-scrollbar {
  width: 5px;
}

.ai-textarea::-webkit-scrollbar-track {
  background: transparent;
}

.ai-textarea::-webkit-scrollbar-thumb {
  background: #3e5576;
  border-radius: 4px;
}

.ai-textarea::-webkit-scrollbar-thumb:hover {
  background: #5373a0;
}

.ai-textarea::placeholder {
  color: #6a82a2;
  font-size: 11.5px;
}

.ai-send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 0;
  background: #33619e;
  color: #ffffff;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.ai-send-btn:hover:not(:disabled) {
  background: #4275ba;
  color: #ffffff;
  transform: translateY(-1px);
}

.ai-send-btn:active:not(:disabled) {
  transform: translateY(0);
}

.ai-send-btn:disabled {
  opacity: 0.4;
  cursor: default;
  background: transparent;
  color: #556c88;
}

.ai-send-btn svg {
  width: 13px;
  height: 13px;
}

.ai-stop-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 0;
  background: #993333;
  color: #ffffff;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.ai-stop-btn:hover {
  background: #b83d3d;
  transform: translateY(-1px);
}

.ai-stop-btn:active {
  transform: translateY(0);
}

.ai-stop-btn svg {
  width: 13px;
  height: 13px;
}

.ai-input-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 8.5px;
  color: #5f7491;
  padding: 0 2px;
}

/* Sub-View Panel (Riwayat Sesi & Statistik Token) */
.ai-subview-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  background: #222c3c;
}

.ai-subview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: #1a2331;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.ai-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 0;
  color: #88a1c0;
  font-size: 10.5px;
  font-weight: 500;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 5px;
  transition: all 0.15s ease;
}

.ai-back-btn:hover {
  color: #cce0f8;
  background: rgba(255, 255, 255, 0.06);
}

.ai-back-arrow {
  display: inline-flex;
  transform: rotate(180deg);
}

.ai-back-btn svg {
  width: 12px;
  height: 12px;
}

.ai-subview-new-btn,
.ai-subview-reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 5px;
  border: 1px solid #354a67;
  background: #223044;
  color: #9bbfe8;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ai-subview-new-btn:hover {
  background: #2a3c55;
  color: #ffffff;
  border-color: #4b6b97;
}

.ai-subview-reset-btn {
  border-color: #552f2f;
  background: #2b1f22;
  color: #e58787;
}

.ai-subview-reset-btn:hover {
  background: #3b252a;
  color: #ff9e9e;
  border-color: #783838;
}

.ai-subview-new-btn svg,
.ai-subview-reset-btn svg {
  width: 11px;
  height: 11px;
}

.ai-subview-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
}

.ai-subview-title-row h4 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: #d8e5f5;
}

.ai-subview-desc {
  margin: 2px 0 0;
  font-size: 9.5px;
  color: #6a82a0;
}

.ai-subview-count-badge {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  background: #182332;
  border: 1px solid #2e415b;
  color: #8eb3df;
  flex-shrink: 0;
}

/* History Toolbar: Pilih, Export, Import, Hapus Semua */
.ai-history-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 12px;
  background: #192230;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.ai-htool-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ai-htool-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ai-htool-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 4px;
  border: 1px solid #2f4057;
  background: #1d2736;
  color: #8da5c3;
  font-size: 9.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ai-htool-btn:hover:not(:disabled) {
  background: #28374c;
  color: #d2e4fa;
  border-color: #425b7d;
}

.ai-htool-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ai-htool-btn.is-active {
  background: #1e3a5f;
  border-color: #3d6e9f;
  color: #8ec3ff;
}

.ai-htool-btn.danger {
  border-color: #482c2f;
  background: #251b1e;
  color: #d97777;
}

.ai-htool-btn.danger:hover:not(:disabled) {
  background: #382025;
  color: #ff9494;
  border-color: #693237;
}

.ai-htool-btn svg {
  width: 11px;
  height: 11px;
}

/* Konfirmasi Hapus Semua Sesi */
.ai-confirm-delete-all-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px;
  margin: 6px 10px 0;
  border-radius: 6px;
  background: #2a1b1e;
  border: 1px solid #5d2b30;
  color: #fca5a5;
  font-size: 10px;
  flex-shrink: 0;
}

.ai-confirm-text strong {
  display: block;
  font-size: 10.5px;
  color: #fecaca;
  margin-bottom: 2px;
}

.ai-confirm-text span {
  color: #d19797;
  font-size: 9.5px;
}

.ai-confirm-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.ai-confirm-btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  border: 0;
  background: #991b1b;
  color: #ffffff;
  font-size: 9.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.ai-confirm-btn-danger:hover {
  background: #b91c1c;
}

.ai-confirm-btn-danger svg {
  width: 10px;
  height: 10px;
}

.ai-confirm-btn-cancel {
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid #4a3034;
  background: transparent;
  color: #d2a5a5;
  font-size: 9.5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ai-confirm-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

/* Action Bar untuk Multi-Select Sesi */
.ai-selection-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 10px;
  margin: 6px 10px 0;
  border-radius: 6px;
  background: #172435;
  border: 1px solid #2d4567;
  flex-shrink: 0;
}

.ai-selection-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-selection-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ai-sel-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2.5px 7px;
  border-radius: 4px;
  border: 1px solid #334e73;
  background: #20324a;
  color: #9dc2ec;
  font-size: 9.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ai-sel-btn:hover:not(:disabled) {
  background: #2b4363;
  color: #ffffff;
}

.ai-sel-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.ai-sel-btn.danger {
  border-color: #552d30;
  background: #2d1c20;
  color: #f87171;
}

.ai-sel-btn.danger:hover:not(:disabled) {
  background: #402329;
  color: #fca5a5;
}

.ai-sel-btn.close {
  padding: 2.5px 4px;
  background: transparent;
  border: 0;
  color: #728ca8;
}

.ai-sel-btn.close:hover {
  color: #ffffff;
}

.ai-sel-btn svg {
  width: 11px;
  height: 11px;
}

.ai-selection-count-badge {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 8px;
  background: #1f3756;
  color: #8cc4ff;
}

/* Banner Notifikasi */
.ai-notice-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  margin: 6px 10px 0;
  border-radius: 5px;
  background: #142a22;
  border: 1px solid #235843;
  color: #86efac;
  font-size: 9.5px;
  flex-shrink: 0;
}

.ai-notice-close {
  background: none;
  border: 0;
  color: #6ee7b7;
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
}

.ai-notice-close svg {
  width: 11px;
  height: 11px;
}

/* Riwayat Sesi (Session History List) */
.ai-session-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: #3b4e69 transparent;
}

.ai-session-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  background: #1b2534;
  border: 1px solid #2c3e56;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.ai-session-card:hover {
  background: #233145;
  border-color: #435e83;
}

.ai-session-card.is-active {
  background: #24354c;
  border-color: #4272a8;
  box-shadow: 0 0 0 1px rgba(66, 114, 168, 0.3);
}

.ai-session-card.is-selected {
  background: #1d2f47;
  border-color: #3f6fa3;
}

.ai-session-card.is-select-mode {
  cursor: pointer;
}

.ai-card-checkbox-wrap {
  display: grid;
  place-items: center;
  margin-right: 2px;
  flex-shrink: 0;
}

.ai-card-checkbox {
  display: grid;
  place-items: center;
  color: #5d7594;
  transition: color 0.15s ease;
}

.ai-card-checkbox.is-checked {
  color: #38bdf8;
}

.ai-card-checkbox svg {
  width: 15px;
  height: 15px;
}

.ai-session-card-body {
  flex: 1;
  min-width: 0;
}

.ai-session-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
}

.ai-session-card-title {
  font-size: 11.5px;
  font-weight: 500;
  color: #dce7f6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.ai-active-session-badge {
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 3px;
  background: #1f4f82;
  color: #92c5ff;
  flex-shrink: 0;
}

.ai-session-rename-form {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.ai-session-rename-input {
  flex: 1;
  min-width: 0;
  height: 22px;
  background: #131b26;
  border: 1px solid #4a678f;
  border-radius: 4px;
  padding: 0 6px;
  color: #ffffff;
  font-size: 11px;
  outline: none;
}

.ai-session-rename-input:focus {
  border-color: #7eb3f0;
  box-shadow: 0 0 0 1px rgba(126, 179, 240, 0.3);
}

.ai-rename-action-btn {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: all 0.15s ease;
}

.ai-rename-action-btn.check {
  background: #1e5235;
  color: #86efac;
}

.ai-rename-action-btn.check:hover {
  background: #256b44;
}

.ai-rename-action-btn.cancel {
  background: #3c2427;
  color: #fca5a5;
}

.ai-rename-action-btn.cancel:hover {
  background: #522d32;
}

.ai-rename-action-btn svg {
  width: 12px;
  height: 12px;
}

.ai-session-card-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  font-size: 9px;
  color: #7289a6;
  overflow: hidden;
}

.ai-session-meta-item {
  white-space: nowrap;
}

.ai-session-meta-dot {
  color: #465b74;
}

.ai-session-meta-model {
  color: #8cb1dc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-session-card-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

.ai-session-card:hover .ai-session-card-actions {
  opacity: 1;
}

.ai-session-icon-btn {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: transparent;
  border: 0;
  color: #6a82a0;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
}

.ai-session-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #c2d8f5;
}

.ai-session-icon-btn.danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.ai-session-icon-btn svg {
  width: 12px;
  height: 12px;
}

.ai-empty-history {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px 10px;
  gap: 8px;
  color: #778fae;
}

.ai-empty-history svg {
  width: 28px;
  height: 28px;
  color: #567296;
}

.ai-empty-history p {
  margin: 0;
  font-size: 11px;
}

.ai-empty-history small {
  font-size: 9.5px;
  color: #5c7492;
}

.ai-btn-primary {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 6px;
  border: 0;
  background: #2b5484;
  color: #ffffff;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.ai-btn-primary:hover {
  background: #3668a3;
}

.ai-btn-primary svg {
  width: 12px;
  height: 12px;
}

/* Statistik Penggunaan Token View */
.ai-stats-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: #3b4e69 transparent;
}

.ai-stats-summary-card {
  padding: 10px 12px;
  border-radius: 8px;
  background: linear-gradient(145deg, #182332 0%, #131b27 100%);
  border: 1px solid #334661;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-stats-summary-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ai-stats-summary-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  color: #7995b9;
}

.ai-stats-summary-val-wrap {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.ai-stats-summary-val {
  font-size: 22px;
  font-weight: 700;
  color: #8dc1fd;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.ai-stats-summary-unit {
  font-size: 10px;
  color: #6d89ae;
}

.ai-stats-summary-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ai-stats-metric {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ai-metric-label {
  font-size: 8.5px;
  color: #6983a3;
}

.ai-metric-value {
  font-size: 11.5px;
  font-weight: 600;
  color: #d1dfef;
  font-variant-numeric: tabular-nums;
}

.ai-stats-metric-sep {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.08);
}

.ai-stats-section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #879ebc;
  padding-left: 2px;
}

.ai-stats-models-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.ai-stats-model-card {
  padding: 9px 11px;
  border-radius: 7px;
  background: #1b2535;
  border: 1px solid #2e415b;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.ai-stats-model-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.ai-stats-model-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ai-stats-model-name {
  margin: 0;
  font-size: 11.5px;
  font-weight: 600;
  color: #dbe7f7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-stats-provider-pill {
  font-size: 8.5px;
  color: #7998be;
}

.ai-stats-model-total {
  display: flex;
  align-items: baseline;
  gap: 3px;
  flex-shrink: 0;
}

.ai-stats-model-total-val {
  font-size: 13px;
  font-weight: 700;
  color: #7bb5f7;
  font-variant-numeric: tabular-nums;
}

.ai-stats-model-total-unit {
  font-size: 9px;
  color: #637f9f;
}

.ai-stats-model-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 6px 8px;
  background: #151d2a;
  border-radius: 5px;
}

.ai-stats-model-cell {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ai-cell-label {
  font-size: 8px;
  color: #677e9a;
}

.ai-cell-val {
  font-size: 10.5px;
  font-weight: 600;
  color: #c9d8eb;
  font-variant-numeric: tabular-nums;
}

.ai-stats-model-footer {
  font-size: 8.5px;
  color: #5c7490;
}

.ai-stats-footnote {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  color: #5b7391;
  margin-top: 4px;
  padding: 4px 2px;
}

.ai-stats-footnote svg {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
  color: #4f6885;
}

/* AI Drawer & 3-Column Workspace Layout */
.workspace {
  --ai-width: clamp(280px, var(--ai-drawer-width, 390px), calc(100vw - 420px));
}

@media (min-width: 761px) {
  .workspace.ai-panel-open {
    grid-template-columns: var(--explorer-width) minmax(0, 1fr) var(--ai-width);
  }
  .workspace.explorer-collapsed.ai-panel-open {
    grid-template-columns: 49px minmax(0, 1fr) var(--ai-width);
  }
  .workspace.ai-panel-open .ai-right-drawer {
    border-radius: 12px 0 0 12px;
    border-left: 1px solid #3e4d63;
  }
  .workspace.ai-panel-open > main {
    border-radius: 12px 10px 10px 12px;
    border-right: 1px solid #dfe7f2;
  }
}

/* AI Panel Resize Handle (identik dengan sidebar-resize-handle di kiri) */
.ai-resize-handle {
  position: fixed;
  top: 0;
  bottom: 0;
  right: calc(var(--ai-width, 390px) - 4px);
  width: 8px;
  z-index: 10;
  cursor: col-resize;
  touch-action: none;
  outline: none;
}
.ai-resize-handle::after {
  content: "";
  position: absolute;
  inset: 0 3px;
  background: transparent;
  transition: background 0.15s;
}
.ai-resize-handle:hover::after,
.ai-resize-handle:focus-visible::after,
.ai-resizing .ai-resize-handle::after {
  background: #85b4ff;
}
.ai-resizing,
.ai-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}
@media (max-width: 760px) {
  .ai-resize-handle {
    display: none;
  }
}
@media (min-width: 761px) {
  .ai-resize-handle {
    right: calc(var(--ai-width, 390px) + 2px);
    top: 7px;
    bottom: 7px;
    width: 8px;
    border-radius: 6px;
    background: transparent;
    transition: background 0.15s;
  }
  .ai-resize-handle::before {
    content: "";
    position: absolute;
    top: 7px;
    bottom: 7px;
    left: 3px;
    width: 1px;
    background: #60738b55;
    transition: background 0.15s;
  }
  .ai-resize-handle::after {
    content: "";
    position: absolute;
    top: 50%;
    bottom: auto;
    left: 1px;
    right: auto;
    width: 6px;
    height: 34px;
    transform: translateY(-50%);
    border-radius: 4px;
    background: radial-gradient(circle, #91a7c4 1px, transparent 1.2px) center / 6px 6px repeat-y;
    box-shadow: 0 0 0 3px #1b2533;
    transition: box-shadow 0.15s;
  }
  .ai-resize-handle:hover,
  .ai-resize-handle:focus-visible,
  .ai-resizing .ai-resize-handle {
    background: #34496588;
  }
  .ai-resize-handle:hover::before,
  .ai-resize-handle:focus-visible::before,
  .ai-resizing .ai-resize-handle::before {
    background: #85b4ff;
  }
  .ai-resize-handle:hover::after,
  .ai-resize-handle:focus-visible::after,
  .ai-resizing .ai-resize-handle::after {
    background: radial-gradient(circle, #c3dcff 1px, transparent 1.2px) center / 6px 6px repeat-y;
    box-shadow: 0 0 0 3px #2a3b52;
  }
  .ai-resize-handle:focus-visible {
    outline: 1px solid #85b4ff;
    outline-offset: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ai-resize-handle,
  .ai-resize-handle::before,
  .ai-resize-handle::after {
    transition: none;
  }
}

.ai-right-drawer {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 0;
  background: #192230;
  border-left: 1px solid #233144;
  overflow: hidden;
  position: relative;
  z-index: 10;
}

.ai-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #151d29;
  border-bottom: 1px solid #233144;
  flex-shrink: 0;
}

.ai-drawer-title {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #b9d7fb;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.ai-drawer-title svg {
  width: 14px;
  height: 14px;
  color: #6da2ec;
}

.ai-drawer-close {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: transparent;
  color: #8fa5c2;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ai-drawer-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.ai-drawer-close svg {
  width: 14px;
  height: 14px;
}

.ai-right-drawer .ai-chat-panel {
  flex: 1;
  min-height: 0;
  height: auto;
}

@media (max-width: 760px) {
  .ai-right-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(420px, 92vw);
    z-index: 50;
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.45);
  }
}

.ai-action-confirm {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(96, 165, 250, 0.35);
  color: #e2e8f0;
  font-size: 11.5px;
}

.ai-action-confirm.is-danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(248, 113, 113, 0.42);
}

.ai-action-confirm-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ai-action-confirm-head svg {
  width: 14px;
  height: 14px;
  flex: none;
}

.ai-action-confirm-preview {
  margin: 0;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.45);
  color: #cbd5e1;
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-action-confirm-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-confirm-btn {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.ai-confirm-btn.primary {
  background: #2563eb;
  color: #ffffff;
}

.ai-confirm-btn.primary:hover {
  background: #1d4ed8;
}

.ai-confirm-btn.danger {
  background: #dc2626;
  color: #ffffff;
}

.ai-confirm-btn.danger:hover {
  background: #b91c1c;
}

.ai-confirm-btn.secondary {
  background: transparent;
  border-color: rgba(148, 163, 184, 0.35);
  color: #cbd5e1;
}

.ai-confirm-btn.secondary:hover {
  background: rgba(148, 163, 184, 0.14);
}

.ai-action-chip.is-rejected {
  opacity: 0.72;
  cursor: default;
  border-color: rgba(148, 163, 184, 0.3);
  background: rgba(148, 163, 184, 0.1);
}
