.ai-widget { --ai-brand: #146e66; --ai-line: #dfe7e4; position: fixed; right: 22px; bottom: max(22px, env(safe-area-inset-bottom)); z-index: 40; font-size: 14px; color: #203630; }
.ai-launcher { width: 64px; height: 64px; border-radius: 50%; padding: 3px; background: #fff; border: 1px solid #c6dfd6; box-shadow: 0 5px 20px #164b3424; cursor: pointer; display: grid; place-items: center; }
.ai-launcher img { width: 54px; height: 54px; transition: transform .2s; }
.ai-launcher:hover img { transform: rotate(-7deg); }
.ai-greeting { position: absolute; width: min(310px, calc(100vw - 40px)); right: 0; bottom: 78px; padding: 18px; border: 1px solid var(--ai-line); border-radius: 16px 16px 4px 16px; background: #fff; box-shadow: 0 10px 34px #164b341a; }
.ai-greeting p { margin: 8px 0 12px; color: #5a6d66; line-height: 1.7; font-size: 13px; }
.ai-greeting strong { display: block; padding-right: 25px; overflow-wrap: anywhere; }
.ai-dismiss { position: absolute; top: 8px; right: 9px; padding: 3px 8px; border: 0; background: transparent; color: #587067; }
.ai-greeting .ai-shortcuts { margin: 0; }
.ai-panel { position: fixed; right: 22px; bottom: 98px; width: min(440px, calc(100vw - 32px)); height: min(730px, calc(100dvh - 125px)); max-height: calc(100vh - 125px); background: #fff; border: 1px solid var(--ai-line); border-radius: 18px; box-shadow: 0 14px 60px #173d332b; display: flex; flex-direction: column; overflow: hidden; }
.ai-header { display: flex; align-items: center; gap: 10px; padding: 15px 16px; border-bottom: 1px solid var(--ai-line); flex-shrink: 0; }
.ai-header img { width: 38px; height: 38px; }
.ai-header h2 { font-size: 16px; margin: 0; }
.ai-header small { color: #687a72; font-size: 11px; }
.ai-header .ai-close { margin-left: auto; }
.ai-panel button { cursor: pointer; font: inherit; }
.ai-icon-button { border: 1px solid var(--ai-line); border-radius: 8px; background: #fff; padding: 5px 9px; color: #475f55; }
.ai-nav { padding: 10px 14px; background: #f7faf8; border-bottom: 1px solid var(--ai-line); display: flex; gap: 8px; align-items: center; }
.ai-nav select { min-width: 0; flex: 1; font: inherit; padding: 7px; border-radius: 7px; border: 1px solid var(--ai-line); background: #fff; }
.ai-nav button { padding: 7px; font-size: 12px; }
.ai-messages { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px; background: #fafcfb; }
.ai-welcome { text-align: center; padding: 20px 8px 12px; color: #61776c; line-height: 1.8; }
.ai-welcome img { width: 64px; height: 64px; }
.ai-welcome h3 { color: #203c30; margin: 6px 0; font-size: 17px; }
.ai-welcome p { font-size: 13px; margin: 6px 0; }
.ai-shortcuts { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-top: 16px; }
.ai-shortcuts button { font-size: 12px; padding: 7px 10px; background: #fff; color: var(--ai-brand); border: 1px solid #d7e7de; border-radius: 16px; }
.ai-message { margin: 14px 0; }
.ai-message-label { font-size: 11px; color: #74847d; margin-bottom: 5px; }
.ai-message-content { padding: 11px 13px; background: #fff; border: 1px solid #e7ede9; border-radius: 0 12px 12px 12px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; font-size: 13px; }
.ai-message.user .ai-message-content { background: #e6f3ed; border-color: #d9ece2; border-radius: 12px 0 12px 12px; }
.ai-message.user .ai-message-label { text-align: right; }
.ai-proposal { margin-top: 10px; background: #fff; border: 1px solid #bfd7ca; border-radius: 10px; padding: 12px; }
.ai-proposal-title { display: flex; gap: 7px; align-items: flex-start; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.ai-proposal input[type=checkbox] { width: 16px; height: 16px; flex-shrink: 0; margin: 3px 0 0; accent-color: var(--ai-brand); }
.ai-proposal dl { margin: 9px 0; display: grid; grid-template-columns: 70px minmax(0,1fr); gap: 6px; font-size: 12px; line-height: 1.6; }
.ai-proposal dt { color: #718278; }
.ai-proposal dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.ai-proposal p { font-size: 12px; line-height: 1.7; color: #6a7e72; }
.ai-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }
.ai-actions button { padding: 6px 10px; font-size: 12px; border: 1px solid var(--ai-line); border-radius: 7px; background: #fff; color: #435d4c; }
.ai-actions .ai-primary, .ai-primary { background: var(--ai-brand); color: #fff; border: 1px solid var(--ai-brand); border-radius: 8px; }
.ai-proposal-status { font-size: 12px; color: var(--ai-brand); font-weight: 600; }
.ai-error { color: #a53f30; font-size: 12px; line-height: 1.6; padding: 0 14px; margin: 8px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-compose { border-top: 1px solid var(--ai-line); padding: 11px 14px 12px; background: #fff; flex-shrink: 0; }
.ai-compose textarea { display: block; width: 100%; min-height: 64px; max-height: 120px; resize: vertical; border: 1px solid #d5e1da; border-radius: 10px; padding: 9px 11px; font: inherit; font-size: 13px; line-height: 1.5; }
.ai-compose-footer { display: flex; gap: 8px; justify-content: space-between; align-items: center; margin-top: 8px; }
.ai-compose-footer small { color: #7d8a82; font-size: 10px; }
.ai-compose-footer button { padding: 7px 16px; font-size: 13px; }
.ai-batch { padding: 8px 14px; background: #f0f7f3; display: flex; align-items: center; gap: 8px; font-size: 12px; }
.ai-batch button { margin-left: auto; padding: 6px 10px; font-size: 12px; }
.ai-panel button:disabled { opacity: .5; cursor: default; }
.ai-edit { display: grid; gap: 7px; margin-top: 10px; }
.ai-edit label { font-size: 12px; color: #60766a; }
.ai-edit input, .ai-edit select, .ai-edit textarea { font: inherit; font-size: 12px; width: 100%; min-width: 0; padding: 7px; border: 1px solid #cdded3; border-radius: 6px; }
.ai-delete-card { margin: 10px 14px; padding: 12px; border: 1px solid #e8cbbf; border-radius: 10px; font-size: 13px; }
.ai-widget :focus-visible { outline: 3px solid #6ab6a0; outline-offset: 2px; }
@media (max-width: 600px) {
 .ai-widget { right: 15px; bottom: max(15px, env(safe-area-inset-bottom)); }
 .ai-launcher { width: 56px; height: 56px; }
 .ai-launcher img { width: 48px; height: 48px; }
 .ai-panel { inset: 8px; bottom: max(8px, env(safe-area-inset-bottom)); width: auto; height: auto; max-height: none; border-radius: 14px; z-index: 1; }
 .ai-widget:has(.ai-panel:not([hidden])) .ai-launcher { visibility: hidden; }
 .ai-greeting p { display: none; }
 .ai-header { padding: 12px; }
 .ai-messages { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) { .ai-launcher img { transition: none; } }

.ai-input-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.ai-project-option { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; line-height: 1.7; color: #315b48; }
.ai-proposal details { font-size: 12px; line-height: 1.7; }
.ai-proposal details ul { padding-left: 20px; overflow-wrap: anywhere; }
@media (max-width:600px) { body.ai-chat-open { overflow: hidden; } }

.ai-retention-notice { margin: 0; padding: 7px 14px; color: #6d8075; background: #f4f8f5; border-bottom: 1px solid var(--ai-line); font-size: 11px; line-height: 1.6; flex-shrink: 0; }

.ai-diff { margin-top: 10px; font-size: 12px; line-height: 1.6; border: 1px solid var(--ai-line); border-radius: 7px; overflow: hidden; }
.ai-diff-heading, .ai-diff-row { display: grid; grid-template-columns: 60px minmax(0,1fr) minmax(0,1fr); }
.ai-diff-heading { background: #f1f7f3; color: #60776a; font-weight: 600; }
.ai-diff-row + .ai-diff-row { border-top: 1px solid var(--ai-line); }
.ai-diff span, .ai-diff strong { padding: 7px; overflow-wrap: anywhere; white-space: pre-wrap; min-width: 0; }
.ai-diff strong { color: #146e66; background: #f5faf7; font-weight: 500; }

.ai-dependency-note { padding: 8px; background: #f2f7f3; border-radius: 6px; border-left: 3px solid #70a58c; }
