.ai-assistant-root { --ai-accent: #147d72; --ai-soft: #eef7f5; letter-spacing: 0; }
.ai-assistant-root [hidden], .ai-settings [hidden] { display: none !important; }
.ai-icon-button { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 32px; border-radius: 6px; }
.ai-icon-button img, .ai-command img { display: block; flex: none; }
.ai-command { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.ai-command.primary img, .ai-icon-button.primary img { filter: invert(1); }
.ai-launcher-tools { position: fixed; z-index: 85; right: 22px; bottom: max(20px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.ai-launcher { position: static; width: 48px; height: 48px; border-radius: 50%; background: var(--ai-accent); border-color: var(--ai-accent); box-shadow: 0 4px 18px #10243e24; }
.ai-launcher img { width: 23px; height: 23px; filter: invert(1); }
.ai-launcher:hover { background: #116b62; border-color: #116b62; }
.ai-hide-button { width: 32px; height: 32px; padding: 0; border-color: var(--border); background: var(--panel); box-shadow: 0 2px 8px #10243e1f; opacity: 0; pointer-events: none; transform: translateY(4px); transition: opacity .14s ease-out, transform .14s ease-out; }
.ai-launcher-tools:hover .ai-hide-button, .ai-launcher-tools:focus-within .ai-hide-button { opacity: 1; pointer-events: auto; transform: translateY(0); }
@media (hover: hover) and (pointer: fine) {
  .ai-launcher-tools { right: 0; transform: translateX(calc(100% - 10px)); transition: transform .16s ease-out; }
  .ai-launcher-tools:hover, .ai-launcher-tools:focus-within { transform: translateX(0); }
}
.ai-panel { position: fixed; z-index: 90; right: 18px; bottom: 18px; width: min(460px, calc(100vw - 36px)); height: min(760px, calc(100dvh - 36px)); display: flex; flex-direction: column; min-width: 0; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 12px 44px #10243e30; overflow: hidden; animation: ai-open .16s ease-out; }
.ai-panel.expanded { width: min(1160px, calc(100vw - 36px)); height: calc(100dvh - 36px); }
.ai-header { display: flex; align-items: center; gap: 8px; min-height: 70px; padding: 12px 14px; border-bottom: 1px solid var(--border); background: linear-gradient(110deg, var(--ai-soft), #fff 70%); flex-shrink: 0; }
.ai-heading { min-width: 0; flex: 1; }
.ai-heading h2 { margin: 0; font-size: 16px; line-height: 1.4; overflow-wrap: anywhere; }
.ai-subtitle { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.ai-header-tools { display: flex; align-items: center; gap: 4px; flex: none; }
.ai-header-tools .ai-icon-button { border-color: transparent; background: transparent; }
.ai-header-tools .ai-icon-button:hover { background: #e8eef1; }
.ai-mode-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; gap: 8px; flex-shrink: 0; }
.ai-mode { display: inline-flex; border-bottom: 1px solid var(--border); gap: 14px; min-width: 0; }
.ai-mode button { border: 0; border-radius: 0; border-bottom: 2px solid transparent; padding: 5px 0; font-size: 13px; overflow-wrap: anywhere; }
.ai-mode button[aria-pressed="true"] { color: var(--ai-accent); border-bottom-color: var(--ai-accent); font-weight: 600; }
.ai-scope { padding: 0 14px 10px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 10px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.ai-scope .field { margin: 0; min-width: 0; }
.ai-scope .field input, .ai-scope .field select { width: 100%; min-width: 0; height: 36px; padding: 5px 8px; }
.ai-customer-field, .ai-scope-basis { grid-column: 1 / -1; }
.ai-scope-basis { color: var(--muted); font-size: 11px; }
.ai-scope .customer-picker-toggle { height: 36px; }
.ai-scope .customer-picker-panel { width: 100%; max-width: 100%; z-index: 4; }
.ai-scope .customer-picker-list { max-height: 200px; }
.ai-customer-box { min-width: 0; font-size: 12px; }
.ai-messages { flex: 1; min-height: 70px; min-width: 0; overflow: auto; overscroll-behavior: contain; padding: 6px 16px 12px; scrollbar-width: thin; scroll-padding-block: 12px; }
.ai-empty { display: flex; flex-direction: column; align-items: stretch; gap: 3px; padding: 22px 0; }
.ai-empty-title { color: var(--muted); font-size: 12px; margin-bottom: 7px; }
.ai-suggestion { padding: 10px 0; text-align: left; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; font-size: 13px; overflow-wrap: anywhere; }
.ai-suggestion:hover { color: var(--ai-accent); }
.ai-message { min-width: 0; padding: 14px 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.ai-message-label { display: flex; gap: 8px; align-items: baseline; font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.ai-message-state { font-weight: 400; font-size: 10px; }
.ai-question .ai-message-text { font-weight: 500; }
.ai-message-text { white-space: pre-wrap; font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }
.ai-answer .ai-message-label { color: var(--ai-accent); }
.ai-message-actions { display: flex; justify-content: flex-end; min-height: 24px; margin-top: 6px; }
.ai-message-actions .copy-field-btn { position: static; width: 28px; height: 26px; }
.ai-bill { border-left: 3px solid var(--ai-accent); background: var(--ai-soft); padding: 10px 12px; margin: 0 0 12px; font-size: 12px; }
.ai-bill-title { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-weight: 600; }
.ai-bill-title > span { font-weight: 400; color: var(--muted); }
.ai-bill-amount { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; margin: 6px 0; }
.ai-bill-amount strong { font-size: 20px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ai-bill-meta { color: var(--muted); font-size: 10px; }
.ai-bill a, .ai-sources a { color: var(--primary); text-decoration: none; }
.ai-bill a:hover, .ai-sources a:hover { text-decoration: underline; }
.ai-sources { display: flex; flex-direction: column; gap: 5px; margin-top: 14px; font-size: 12px; }
.ai-source-title { color: var(--muted); font-size: 11px; }
.ai-sources a { width: fit-content; max-width: 100%; overflow-wrap: anywhere; }
.ai-composer { padding: 8px 14px 10px; border-top: 1px solid var(--border); background: #fafbfd; flex-shrink: 0; }
.ai-notification { min-height: 18px; color: var(--muted); font-size: 11px; margin-bottom: 6px; overflow-wrap: anywhere; }
.ai-notification.err { color: var(--err); }
.ai-input-row { display: flex; align-items: flex-end; gap: 8px; }
.ai-input-row textarea { display: block; min-width: 0; flex: 1; resize: vertical; min-height: 64px; max-height: 130px; border-radius: 6px; font-size: 13px; }
.ai-send-tools { flex: none; padding-bottom: 1px; }
.ai-disclaimer { margin-top: 7px; font-size: 10px; color: var(--muted); text-align: center; }
.ai-settings { min-width: 0; }
.ai-settings .field { margin-bottom: 12px; }
.ai-settings input { min-width: 0; }
.ai-settings .ai-toggle { display: flex; gap: 8px; align-items: center; margin: 12px 0; overflow-wrap: anywhere; }
.ai-config-status { min-height: 24px; margin: 8px 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.ai-config-status.err { color: var(--err); }
.ai-config-status.ok { color: #147d72; }
.ai-config-policy { margin: 14px 0; padding: 10px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.ai-settings .modal-actions { flex-wrap: wrap; }
@keyframes ai-open { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .ai-panel { animation: none; } }
@media (max-width: 600px) {
  body:has(.ai-panel:not([hidden])) .mobile-nav-button { visibility: hidden; }
  .ai-launcher-tools { right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); transform: none; }
  .ai-panel, .ai-panel.expanded { inset: 8px; width: auto; height: calc(100dvh - 16px); }
  .ai-header { padding: 10px; gap: 4px; min-height: 64px; }
  .ai-header-tools { gap: 1px; }
  .ai-header-tools .ai-icon-button { width: 30px; height: 32px; flex-basis: 30px; }
  .ai-mode-bar, .ai-composer { padding-left: 10px; padding-right: 10px; }
  .ai-scope { padding-left: 10px; padding-right: 10px; }
  .ai-messages { padding-left: 12px; padding-right: 12px; }
}
@media print { .ai-assistant-root { display: none !important; } }