/* Local AI Assistant */
.local-ai-floating {
    position: fixed;
    right: 28px;
    bottom: 28px;
    z-index: 480;
    font-family: 'AvenirNext', Arial, sans-serif;
}

.local-ai-floating-button {
    width: 54px;
    height: 54px;
    border: 0;
    border-radius: 50%;
    background: #2D4563;
    color: #ffffff;
    box-shadow: 0 12px 28px rgba(45, 69, 99, 0.35);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.local-ai-floating-button:hover {
    background: #3da4f1;
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(61, 164, 241, 0.35);
}

.local-ai-floating-button span:before {
    font-size: 24px;
    line-height: 54px;
}

.local-ai-floating-panel {
    position: absolute;
    right: 0;
    bottom: 70px;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 18px 45px rgba(32, 53, 80, 0.28);
    overflow: hidden;
    border: 1px solid #e8edf4;
}

.local-ai-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2D4563;
    color: #ffffff;
    padding: 14px 16px;
}

.local-ai-panel-header strong {
    display: block;
    font-size: 15px;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
}

.local-ai-panel-header span {
    display: block;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.72);
    margin-top: 1px;
}

.local-ai-panel-close {
    border: 0;
    background: transparent;
    color: #ffffff;
    font-size: 27px;
    line-height: 27px;
    cursor: pointer;
    opacity: 0.8;
}

.local-ai-panel-close:hover {
    opacity: 1;
}

.local-ai-messages {
    height: 340px;
    overflow-y: auto;
    background: #f7f9fc;
    padding: 14px;
}

.local-ai-message {
    display: flex;
    margin-bottom: 10px;
}

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

.local-ai-message-assistant {
    justify-content: flex-start;
}

.local-ai-message-inner {
    max-width: 82%;
    padding: 10px 12px;
    border-radius: 13px;
    font-size: 13px;
    line-height: 18px;
    word-break: break-word;
}

.local-ai-message-user .local-ai-message-inner {
    background: #3da4f1;
    color: #ffffff;
    border-bottom-right-radius: 3px;
}

.local-ai-message-assistant .local-ai-message-inner {
    background: #ffffff;
    color: #3e5a7f;
    border: 1px solid #e8edf4;
    border-bottom-left-radius: 3px;
}

.local-ai-thinking .local-ai-message-inner {
    color: #9db0c9;
    font-style: italic;
}

.local-ai-input-row {
    display: flex;
    gap: 10px;
    padding: 14px;
    background: #ffffff;
    border-top: 1px solid #e8edf4;
}

.local-ai-input-row-compact {
    padding: 12px;
}

.local-ai-input {
    flex: 1;
    min-height: 42px;
    max-height: 130px;
    resize: vertical;
    border: 1px solid #dce5ef;
    border-radius: 8px;
    padding: 9px 10px;
    color: #3e5a7f;
    font-size: 13px;
    line-height: 18px;
    background: #ffffff;
    box-sizing: border-box;
}

.local-ai-input:focus {
    border-color: #3da4f1;
    box-shadow: 0 0 0 2px rgba(61, 164, 241, 0.12);
}

.local-ai-send {
    width: 72px;
    border: 0;
    border-radius: 8px;
    background: #3da4f1;
    color: #ffffff;
    font-size: 13px;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
    cursor: pointer;
}

.local-ai-send:hover {
    background: #2f91d8;
}

.local-ai-send.loading,
.local-ai-send:disabled {
    background: #9db0c9;
    cursor: default;
}

.local-ai-sources {
    background: #ffffff;
    border-top: 1px solid #e8edf4;
    padding: 10px 14px;
    color: #7890ac;
    font-size: 12px;
    line-height: 17px;
    max-height: 100px;
    overflow: auto;
}

.local-ai-sources strong {
    color: #3e5a7f;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
}

.local-ai-sources ul {
    margin: 6px 0 0 16px;
    padding: 0;
}

.local-ai-sources li {
    margin-bottom: 3px;
}

.local-ai-sources a {
    color: #3da4f1;
    text-decoration: none;
}

.local-ai-sources a span strong {
    padding-top: 8px;
    padding-bottom: 8px;
}

.local-ai-sources a:hover {
    color: #5aa9f2;
}

.local-ai-footer-link {
    text-align: center;
    padding: 9px 10px 11px;
    background: #fbfcfe;
    border-top: 1px solid #e8edf4;
    font-size: 12px;
}

.local-ai-footer-link a {
    color: #3da4f1;
    text-decoration: none;
}

.local-ai-page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 38px 30px 60px;
    color: #3e5a7f;
}

.local-ai-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 25px;
    margin-bottom: 24px;
}

.local-ai-page-header h1 {
    font-size: 23px;
    line-height: 36px;
    color: #2D4563;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
    margin: 0 0 8px;
}

.local-ai-page-header p {
    margin: 0;
    color: #7890ac;
    font-size: 15px;
}

.local-ai-model-badge {
    background: #eaf5fe;
    color: #2f91d8;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 12px;
    white-space: nowrap;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
}

.local-ai-page-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.local-ai-chat-card {
    flex: 1;
    background: #ffffff;
    border: 1px solid #e8edf4;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(32, 53, 80, 0.08);
    overflow: hidden;
}

.local-ai-side-card {
    width: 310px;
    background: #ffffff;
    border: 1px solid #e8edf4;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(32, 53, 80, 0.08);
    padding: 18px;
    box-sizing: border-box;
}

.local-ai-side-card h2 {
    font-size: 17px;
    color: #2D4563;
    margin: 0 0 14px;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
}

.local-ai-example {
    display: block;
    width: 100%;
    border: 1px solid #dce5ef;
    background: #fbfcfe;
    color: #3e5a7f;
    border-radius: 9px;
    text-align: left;
    padding: 10px 12px;
    margin-bottom: 9px;
    cursor: pointer;
    font-size: 13px;
    line-height: 18px;
}

.local-ai-example:hover {
    border-color: #3da4f1;
    color: #3da4f1;
    background: #f4faff;
}

.local-ai-side-note {
    margin: 16px 0 0;
    color: #9db0c9;
    font-size: 12px;
    line-height: 17px;
}

@media screen and (max-width: 900px) {
    .local-ai-page-layout,
    .local-ai-page-header {
        display: block;
    }

    .local-ai-side-card {
        width: 100%;
        margin-top: 18px;
    }

    .local-ai-model-badge {
        display: inline-block;
        margin-top: 14px;
    }

    .local-ai-floating-panel {
        width: calc(100vw - 30px);
        right: -15px;
    }
}

/* AI Context Menu Tools */
.local-ai-context-menu-tools {
    position: absolute;
    z-index: 485;
    width: 210px;
    background: #ffffff;
    border: 1px solid #dce5ef;
    border-radius: 9px;
    box-shadow: 0 14px 34px rgba(32, 53, 80, 0.24);
    overflow: hidden;
    font-family: 'AvenirNext', Arial, sans-serif;
}

.local-ai-context-menu-item {
    display: block;
    width: 100%;
    border: 0;
    border-bottom: 1px solid #eef3f8;
    background: #ffffff;
    color: #3e5a7f;
    text-align: left;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 18px;
    cursor: pointer;
    box-sizing: border-box;
}

.local-ai-context-menu-item:last-child {
    border-bottom: 0;
}

.local-ai-context-menu-item:hover,
.local-ai-context-menu-item:focus {
    background: #f4faff;
    color: #2f91d8;
}

.local-ai-context-menu-item:disabled {
    cursor: default;
}

.local-ai-context-menu-history {
    max-height: 330px;
    overflow-y: auto;
    background: #fbfcfe;
}

.local-ai-context-menu-history-title {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 12px;
    border-top: 1px solid #dce5ef;
    border-bottom: 1px solid #e8edf4;
    background: #fbfcfe;
    color: #2D4563;
    font-size: 12px;
    line-height: 16px;
}

.local-ai-context-menu-history-title strong {
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
    font-weight: normal;
}

.local-ai-context-menu-history-title small {
    color: #7890ac;
    font-size: 11px;
    font-weight: normal;
    white-space: nowrap;
}

.local-ai-context-menu-history-item {
    padding: 8px 12px;
    background: #ffffff;
}

.local-ai-context-menu-history-item span {
    display: inline-block;
    max-width: 100%;
    padding: 2px 7px;
    border: 1px solid #e2eaf3;
    border-radius: 999px;
    background: #f5f8fb;
    color: #3e5a7f;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
    font-size: 11px;
    line-height: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

.local-ai-context-menu-history-original span {
    border-color: #cfe9fb;
    background: #eaf5fe;
    color: #2f91d8;
}

.local-ai-context-menu-history-item em {
    display: block;
    margin-top: 4px;
    color: #7890ac;
    font-size: 12px;
    font-style: normal;
    line-height: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.local-ai-context-menu-history-item:hover em,
.local-ai-context-menu-history-item:focus em {
    color: #2f91d8;
}

.local-ai-context-menu-history-current {
    background: #f8fbff;
}

.local-ai-context-menu-history-current span,
.local-ai-context-menu-history-current em {
    opacity: 0.72;
}

.local-ai-context-menu-tools.loading .local-ai-context-menu-item {
    color: #9db0c9;
    cursor: default;
    pointer-events: none;
}

.local-ai-context-menu-tools.loading:after {
    content: 'Processing...';
    display: block;
    padding: 10px 12px;
    color: #7890ac;
    background: #fbfcfe;
    border-top: 1px solid #eef3f8;
    font-size: 12px;
    line-height: 16px;
}

.local-ai-context-field-loading {
    box-shadow: 0 0 0 2px rgba(61, 164, 241, 0.16);
}

.local-ai-context-menu-notice {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 456;
    max-width: 360px;
    padding: 11px 14px;
    border-radius: 9px;
    box-shadow: 0 12px 28px rgba(32, 53, 80, 0.22);
    font-family: 'AvenirNext', Arial, sans-serif;
    font-size: 13px;
    line-height: 18px;
}

.local-ai-context-menu-notice.success {
    background: #eefaf3;
    border: 1px solid #ccebd8;
    color: #32764b;
}

.local-ai-context-menu-notice.error {
    background: #fff3f1;
    border: 1px solid #ffd3cc;
    color: #b54a3b;
}

/* Redesigned AI Agent popup and full page */
.local-ai-floating {
    right: 28px;
    bottom: 28px;
    z-index: 484;
    color: #2f4058;
}

.local-ai-floating-button {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #2D4563;
    box-shadow: 0 16px 34px rgba(31, 52, 80, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.local-ai-floating-button img {
    width: 34px;
    height: 34px;
    display: block;
    position: relative;
    top: 1px;
}

.local-ai-floating-button:hover {
    background: #2D4563;
    transform: translateY(-2px);
    box-shadow: 0 18px 38px rgba(31, 52, 80, 0.42);
}

.local-ai-floating-panel {
    bottom: 74px;
    width: 600px;
    max-width: calc(100vw - 44px);
    border-radius: 28px;
    border: 1px solid #edf1f7;
    box-shadow: 0 26px 64px rgba(31, 52, 80, 0.22);
    overflow: hidden;
}

.local-ai-panel-header {
    min-height: 74px;
    background: #ffffff;
    color: #2f4058;
    padding: 14px 20px;
    border-bottom: 1px solid #edf1f7;
    box-sizing: border-box;
}

.local-ai-brand-block {
    display: flex;
    align-items: center;
    gap: 12px;
}

.local-ai-brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #5aa9f2;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.local-ai-brand-icon img {
    width: 24px;
    height: 24px;
    display: block;
    position: relative;
    top: 7px;
    left: 9px;
}

.local-ai-panel-header strong {
    color: #2f4058;
    font-size: 18px;
    line-height: 22px;
    letter-spacing: 0.1px;
}

.local-ai-panel-header span {
    color: #99abc5;
    font-size: 13px;
    line-height: 17px;
    margin-top: 1px;
}

.local-ai-panel-actions {
    display: flex;
    align-items: center;
    gap: 13px;
}

.local-ai-panel-open,
.local-ai-panel-clear,
.local-ai-panel-close {
    width: 24px;
    height: 24px;
    border: 0;
    background: transparent;
    color: #8da5c7 !important;
    text-decoration: none;
    font-size: 30px;
    line-height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 1;
    font-family: Arial, sans-serif;
}

.local-ai-panel-close {
    font-size: 34px;
    font-weight: 200;
}

.local-ai-panel-clear {
    font-size: 14px;
    line-height: 24px;
}

.local-ai-panel-clear i {
    display: block;
    font-size: 14px;
    line-height: 1;
}

.local-ai-panel-open:hover,
.local-ai-panel-clear:hover,
.local-ai-panel-close:hover {
    color: #5aa9f2 !important;
    text-decoration: none;
}

.local-ai-messages {
    height: 530px;
    background: #ffffff;
    padding: 28px 20px 18px;
    color: #405a80;
    box-sizing: border-box;
}

.local-ai-page .local-ai-messages {
    height: 620px;
    height: calc(100vh - 440px);
    padding: 30px 34px 24px;
}

.local-ai-message {
    margin-bottom: 16px;
}

.local-ai-message-inner {
    max-width: 92%;
    padding: 0;
    border-radius: 0;
    font-size: 15px;
    line-height: 22px;
    color: #405a80;
}

.local-ai-message-user .local-ai-message-inner {
    max-width: 78%;
    background: #5aa9f2;
    color: #ffffff;
    border-radius: 18px 18px 4px 18px;
    padding: 15px 20px;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
    box-shadow: 0 10px 22px rgba(90, 169, 242, 0.18);
}

.local-ai-message-assistant .local-ai-message-inner {
    max-width: 100%;
    background: transparent;
    color: #405a80;
    border: 0;
    border-radius: 0;
}

.local-ai-thinking .local-ai-message-inner {
    color: #9aafcb;
    font-style: normal;
}

.local-ai-step-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0;
    color: #9aafcb;
    font-size: 15px;
}

.local-ai-step-row span {
    color: #79c943;
    font-size: 16px;
    line-height: 18px;
}

.local-ai-step-row .local-ai-step-active-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9aafcb;
    color: transparent;
    font-size: 0;
    line-height: 0;
    flex: 0 0 auto;
}

.local-ai-step-row strong {
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
    font-weight: normal;
}

.local-ai-welcome {
    padding: 5px 0 10px;
    text-align: center;
}

.local-ai-welcome h2 {
    margin: 0 0 6px;
    color: #2f4058;
    font-family: 'AvenirNext-DemiBold', 'AvenirLTStdMedium', Arial, sans-serif;
    font-size: 26px;
    line-height: 40px;
    font-weight: normal;
}

.local-ai-welcome p {
    margin: 0 0 30px;
    color: #8fa0b6;
    font-size: 15px;
    line-height: 21px;
}

.local-ai-try-title {
    margin: 0 0 10px;
    color: #96a4b7;
    text-transform: uppercase;
    text-align: left;
    font-size: 13px;
    line-height: 18px;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
}

.local-ai-prompt-card,
.local-ai-example.local-ai-prompt-card {
    width: 100%;
    min-height: 88px;
    margin: 0 0 12px;
    padding: 17px 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    border: 1px solid #e4e9f1;
    border-radius: 12px;
    background: #ffffff;
    color: #405a80;
    text-align: left;
    box-shadow: 0 1px 1px rgba(31, 52, 80, 0.02);
    box-sizing: border-box;
}

.local-ai-prompt-card:hover,
.local-ai-example.local-ai-prompt-card:hover {
    border-color: #cde2f8;
    background: #fbfdff;
    color: #405a80;
}

.local-ai-prompt-icon {
    width: 24px;
    color: #9db3d3;
    font-size: 30px;
    line-height: 26px;
    flex: 0 0 auto;
}

.local-ai-prompt-card strong {
    display: block;
    margin: 0 0 5px;
    color: #5aa9f2;
    text-transform: uppercase;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
    font-size: 13px;
    line-height: 16px;
}

.local-ai-prompt-card em {
    display: block;
    color: #405a80;
    font-size: 15px;
    line-height: 15px;
    font-style: normal;
}

.local-ai-context-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px 9px;
    background: #ffffff;
    border-top: 1px solid #edf1f7;
    box-sizing: border-box;
}

.local-ai-context-row label {
    display: none;
}

.local-ai-context-pill,
.local-ai-used-context {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    min-width: 0;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 5px;
    background: #f4f6fa;
    color: #9cadc5;
    font-size: 12px;
    line-height: 16px;
    box-sizing: border-box;
}

.local-ai-context-pill strong,
.local-ai-used-context strong {
    color: #2f4058;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
    font-weight: normal;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.local-ai-context-dot {
    width: 9px;
    height: 9px;
    display: inline-block;
    border-radius: 2px;
    background: #79c943;
    flex: 0 0 auto;
    position: relative;
    top: -1px;
}

.local-ai-context-prefix {
    flex: 0 0 auto;
}

.local-ai-context-select-wrap {
    flex: 0 0 auto;
    position: relative;
}

.local-ai-context-module {
    height: 30px;
    min-width: 142px;
    border: 1px solid #e0e7f0;
    border-radius: 7px;
    background: #ffffff;
    color: #6f84a2;
    font-size: 12px;
    line-height: 28px;
    padding: 0 15px 0 5px;
    box-sizing: border-box;
}

.local-ai-input-row {
    padding: 0 20px 10px;
    background: #ffffff;
    border-top: 0;
    display: block;
}

.local-ai-input-row-compact {
    padding: 0 20px 10px;
}

.local-ai-input-shell {
    min-height: 94px;
    position: relative;
    border: 1px solid #e1e7ef;
    border-radius: 16px;
    background: #ffffff;
    box-sizing: border-box;
    overflow: hidden;
}

.local-ai-input {
    width: 100%;
    min-height: 92px;
    max-height: 180px;
    border: 0;
    border-radius: 16px;
    padding: 16px 58px 42px 16px;
    color: #405a80;
    font-size: 15px;
    line-height: 21px;
    resize: vertical;
    box-shadow: none;
    box-sizing: border-box;
}

.local-ai-input:focus {
    border: 0;
    box-shadow: none;
    outline: none;
}

.local-ai-input::placeholder {
    color: #9db0cd;
}

.local-ai-attach {
    position: absolute;
    left: 18px;
    bottom: 12px;
    width: 24px;
    height: 24px;
    border: 0;
    background: transparent;
    color: #8da3c1;
    font-size: 24px;
    line-height: 22px;
    cursor: pointer;
}

.local-ai-send {
    position: absolute;
    right: 12px;
    bottom: 10px;
    width: 41px;
    height: 41px;
    border-radius: 12px;
    background: #5aa9f2;
    color: #ffffff;
    font-size: 24px;
    line-height: 41px;
    padding: 0;
    font-family: Arial, sans-serif;
    box-shadow: none;
}

.local-ai-send:hover {
    background: #479ce8;
}

.local-ai-send.loading,
.local-ai-send:disabled {
    background: #9db0c9;
}

.local-ai-footer-link {
    padding: 0 20px 14px;
    border-top: 0;
    background: #ffffff;
    color: #9aabc2;
    font-size: 11px;
    line-height: 16px;
    text-align: left;
}

.local-ai-sources {
    position: relative;
    max-height: none;
    overflow: visible;
    padding: 9px 20px 9px;
    border-top: 0;
    background: #ffffff;
    color: #405a80;
}

.local-ai-sources-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.local-ai-sources-toggle {
    min-width: 110px;
    height: 42px;
    border: 1px solid #5aa9f2;
    border-radius: 9px;
    background: #ffffff;
    color: #5aa9f2;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
    font-size: 15px;
    cursor: pointer;
}

.local-ai-sources-toggle:hover {
    background: #f4faff;
}

.local-ai-sources-panel {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 60px;
    z-index: 2;
    background: #ffffff;
    border: 1px solid #dfe7f0;
    border-radius: 10px;
    box-shadow: 0 18px 46px rgba(31, 52, 80, 0.18);
    overflow: hidden;
}

.local-ai-sources-panel-header {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    border-bottom: 1px solid #edf1f7;
    box-sizing: border-box;
}

.local-ai-sources-panel-header strong {
    color: #2f4058;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
    font-size: 16px;
}

.local-ai-sources-close {
    width: 24px;
    height: 24px;
    border: 0;
    background: transparent;
    color: #8da5c7;
    font-size: 30px;
    line-height: 22px;
    cursor: pointer;
}

.local-ai-sources-list {
    padding: 12px 18px 16px;
    max-height: 267px;
    overflow: auto;
}

.local-ai-source-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
    color: #405a80;
    text-decoration: none;
}

.local-ai-source-item:hover {
    text-decoration: none;
}

.local-ai-source-icon {
    width: 36px;
    height: 36px;
    border-radius: 5px;
    background: #f2f4f8;
    color: #9db3d3;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-size: 18px;
}

.local-ai-source-item strong {
    display: block;
    color: #2f4058;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
    font-size: 15px;
    line-height: 19px;
}

.local-ai-source-item em {
    display: block;
    margin-top: 2px;
    color: #7e8fa8;
    font-size: 13px;
    line-height: 17px;
    font-style: normal;
}

.local-ai-table-wrap {
    width: 100%;
    margin: 14px 0 18px;
    overflow-x: auto;
}

.local-ai-result-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    color: #405a80;
    font-size: 15px;
    line-height: 20px;
}

.local-ai-result-table th {
    background: #5aa9f2;
    color: #ffffff;
    padding: 11px 18px;
    text-align: left;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
    font-weight: normal;
    border: 1px solid #5aa9f2;
}

.local-ai-result-table td {
    padding: 9px 18px;
    border: 1px solid #e5edf5;
}

.local-ai-message-inner h2,
.local-ai-message-inner h3,
.local-ai-message-inner h4,
.local-ai-message-inner h5,
.local-ai-message-inner h6 {
    margin: 16px 0 8px;
    color: #2f4058;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
    font-weight: normal;
}

.local-ai-message-inner h2 {
    font-size: 19px;
    line-height: 25px;
}

.local-ai-message-inner h3 {
    font-size: 17px;
    line-height: 23px;
}

.local-ai-message-inner h4 {
    font-size: 15px;
    line-height: 21px;
}

.local-ai-message-inner h5,
.local-ai-message-inner h6 {
    font-size: 14px;
    line-height: 20px;
}

.local-ai-message-inner p {
    margin: 0 0 10px;
}

.local-ai-message-inner ul,
.local-ai-message-inner ol {
    margin: 8px 0 12px 22px;
    padding: 0;
}

.local-ai-message-inner li {
    margin: 4px 0;
    padding-left: 2px;
}

.local-ai-message-inner li > ul,
.local-ai-message-inner li > ol {
    margin-top: 5px;
    margin-bottom: 5px;
}

.local-ai-message-inner blockquote {
    margin: 12px 0;
    padding: 9px 12px;
    border-left: 3px solid #5aa9f2;
    background: #f7fbff;
    color: #5f7593;
}

.local-ai-message-inner hr {
    height: 1px;
    margin: 16px 0;
    border: 0;
    background: #dfe8f2;
}

.local-ai-message-inner pre {
    max-width: 100%;
    margin: 12px 0;
    padding: 12px 14px;
    border: 1px solid #dfe8f2;
    border-radius: 6px;
    background: #f6f8fb;
    overflow-x: auto;
    box-sizing: border-box;
    white-space: pre;
}

.local-ai-message-inner pre code {
    padding: 0;
    border-radius: 0;
    background: transparent;
    white-space: pre;
}

.local-ai-message-inner del,
.local-ai-message-inner s {
    color: #7e8fa8;
}

.local-ai-task-marker {
    display: inline-flex;
    width: 15px;
    height: 15px;
    margin-right: 7px;
    border: 1px solid #b9c8d9;
    border-radius: 3px;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 10px;
    line-height: 13px;
    vertical-align: -1px;
    box-sizing: border-box;
}

.local-ai-task-marker.complete {
    border-color: #79c943;
    background: #79c943;
}

.local-ai-message-inner a {
    color: #4c9ee9;
    text-decoration: none;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
}

.local-ai-message-inner a:hover {
    text-decoration: underline;
}

.local-ai-message-inner code {
    padding: 2px 5px;
    border-radius: 4px;
    background: #f4f6fa;
    color: #405a80;
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
}

.local-ai-page {
    max-width: 100%;
    max-width: calc(100% - 160px);
    padding: 36px 30px 64px;
}

.local-ai-page-header {
    min-height: 92px;
    margin-bottom: 24px;
    padding: 20px 24px;
    border: 1px solid #edf1f7;
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 16px 42px rgba(31, 52, 80, 0.08);
    box-sizing: border-box;
}

.local-ai-page-title-block {
    display: flex;
    align-items: center;
    gap: 14px;
}

.local-ai-page-logo {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: #5aa9f2;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.local-ai-page-logo img {
    width: 34px;
    height: 34px;
    display: block;
}

.local-ai-page-header h1 {
    color: #2f4058;
    font-size: 26px;
    line-height: 31px;
    margin-bottom: -4px;
    font-family: 'AvenirNext-DemiBold', 'AvenirLTStdMedium', Arial, sans-serif;
    font-weight: normal;
}

.local-ai-page-header p {
    color: #8fa0b6;
    font-size: 14px;
    line-height: 20px;
}

.local-ai-model-badge {
    background: #f4f6fa;
    color: #5aa9f2;
    border-radius: 8px;
    padding: 9px 13px;
}

.local-ai-page-layout {
    gap: 22px;
}

.local-ai-chat-card,
.local-ai-side-card {
    border: 1px solid #edf1f7;
    border-radius: 22px;
    box-shadow: 0 16px 42px rgba(31, 52, 80, 0.08);
}

.local-ai-chat-card {
    flex: 1 1 auto;
    overflow: hidden;
}

.local-ai-side-card {
    width: 400px;
    padding: 20px;
}

.local-ai-side-card h2,
.local-ai-side-header h2 {
    color: #2f4058;
    font-size: 17px;
    line-height: 22px;
    font-weight: normal;
}

.local-ai-side-card .local-ai-example:not(.local-ai-prompt-card) {
    min-height: 58px;
    border: 1px solid #e4e9f1;
    border-radius: 12px;
    background: #ffffff;
    color: #405a80;
    font-size: 14px;
    line-height: 19px;
    padding: 12px 14px;
}

.local-ai-side-card .local-ai-example:not(.local-ai-prompt-card):hover {
    border-color: #cde2f8;
    background: #fbfdff;
    color: #5aa9f2;
}

.local-ai-conversations-card {
    max-height: calc(100vh - 170px);
    overflow: hidden;
}

.local-ai-conversations {
    max-height: calc(100vh - 250px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
}

.local-ai-conversations::-webkit-scrollbar {
    width: 7px;
}

.local-ai-conversations::-webkit-scrollbar-track {
    background: #f4f6fa;
}

.local-ai-conversations::-webkit-scrollbar-thumb {
    background: #c4d8ef;
    border-radius: 8px;
}

.local-ai-conversation-row {
    display: flex;
    align-items: stretch;
    gap: 6px;
    margin-bottom: 8px;
}

.local-ai-conversation {
    flex: 1;
    min-width: 0;
    border: 1px solid #e4e9f1;
    border-radius: 10px;
    background: #ffffff;
    color: #405a80;
    text-align: left;
    padding: 10px 11px;
    cursor: pointer;
}

.local-ai-conversation strong,
.local-ai-conversation span,
.local-ai-conversation em {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.local-ai-conversation strong {
    color: #2f4058;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
    font-size: 13px;
    line-height: 17px;
}

.local-ai-conversation span,
.local-ai-conversation em {
    color: #8fa0b6;
    font-size: 12px;
    line-height: 16px;
    font-style: normal;
}

.local-ai-conversation-row.active .local-ai-conversation,
.local-ai-conversation-row.selected .local-ai-conversation {
    border-color: #cde2f8;
    background: #f6fbff;
}

.local-ai-conversation-delete,
.local-ai-small-button {
    border: 1px solid #dbe8f8;
    border-radius: 8px;
    background: #ffffff;
    color: #5aa9f2;
    cursor: pointer;
}

.local-ai-conversation-delete {
    width: 32px;
    font-size: 22px;
    line-height: 30px;
}

.local-ai-small-button {
    height: 32px;
    padding: 0 12px;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
}

.local-ai-side-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.local-ai-side-header h2 {
    margin: 0;
}

.local-ai-side-note {
    color: #8fa0b6;
}

@media screen and (max-width: 900px) {
    .local-ai-floating {
        right: 16px;
        bottom: 16px;
    }

    .local-ai-floating-panel {
        right: -8px;
        width: calc(100vw - 30px);
        border-radius: 22px;
    }

    .local-ai-page-header,
    .local-ai-page-layout {
        display: block;
    }

    .local-ai-page-title-block {
        align-items: flex-start;
    }

    .local-ai-model-badge {
        display: inline-block;
        margin-top: 14px;
    }

    .local-ai-side-card {
        width: 100%;
        margin: 18px 0 0;
    }

    .local-ai-context-row {
        align-items: stretch;
        flex-direction: column;
    }

    .local-ai-context-select-wrap,
    .local-ai-context-module {
        width: 100%;
    }
}


/* AI Agent refinements */
.local-ai-page-logo img {
    position: static;
    top: auto;
    left: auto;
}

.local-ai-page-logo img {
    width: 24px;
    height: 24px;
}

.local-ai-panel-open,
.local-ai-panel-clear {
    font-size: 14px;
    line-height: 24px;
}

.local-ai-panel-open i,
.local-ai-panel-clear i {
    display: block;
    font-size: 14px;
    line-height: 1;
}

.local-ai-page-layout-full-mode {
    display: grid;
    grid-template-columns: 20% minmax(0, 1fr) 330px;
    gap: 22px;
    align-items: flex-start;
}

.local-ai-page-layout-full-mode > .local-ai-side-card,
.local-ai-page-layout-full-mode > .local-ai-chat-card {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.local-ai-page-layout-full-mode .local-ai-conversations-card {
    min-width: 210px;
}

.local-ai-page-layout-full-mode .local-ai-chat-card {
    overflow: hidden;
}

.local-ai-page-layout-full-mode .local-ai-message-inner,
.local-ai-page-layout-full-mode .local-ai-result-table {
    max-width: 100%;
}

@media screen and (max-width: 900px) {
    .local-ai-page-layout-full-mode {
        display: block;
    }

    .local-ai-page-layout-full-mode > .local-ai-side-card,
    .local-ai-page-layout-full-mode > .local-ai-chat-card,
    .local-ai-page-layout-full-mode .local-ai-conversations-card {
        width: 100%;
        min-width: 0;
    }
}

/* AI Agent multiple context selector */
.local-ai-context-selected {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 0 20px 10px;
    background: #ffffff;
    box-sizing: border-box;
}

.local-ai-context-chip {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    min-height: 28px;
    border-radius: 999px;
    background: #d9ecff;
    color: #2f4058;
    overflow: hidden;
    box-sizing: border-box;
}

.local-ai-context-chip a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 260px;
    padding: 5px 2px 5px 10px;
    color: #2f4058;
    text-decoration: none;
    box-sizing: border-box;
}

.local-ai-context-chip a:hover {
    color: #2f4058;
    text-decoration: none;
}

.local-ai-context-chip-icon {
    width: 14px;
    height: 14px;
    border: 1px solid #5aa9f2;
    border-radius: 2px;
    color: #5aa9f2;
    font-size: 10px;
    line-height: 12px;
    text-align: center;
    flex: 0 0 auto;
    box-sizing: border-box;
}

.local-ai-context-chip-title {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    line-height: 16px;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
}

.local-ai-context-chip-remove {
    width: 24px;
    height: 26px;
    border: 0;
    background: transparent;
    color: #8da3c1;
    font-size: 18px;
    line-height: 24px;
    cursor: pointer;
    padding: 0 7px 0 2px;
}

.local-ai-context-chip-remove:hover {
    color: #5aa9f2;
}

.local-ai-context-picker {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 156px;
    z-index: 6;
    background: #ffffff;
    border: 1px solid #dfe7f0;
    border-radius: 14px;
    box-shadow: 0 18px 46px rgba(31, 52, 80, 0.18);
    overflow: hidden;
    box-sizing: border-box;
}

.local-ai-page .local-ai-context-picker {
    bottom: 158px;
}

.local-ai-context-picker-header {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px 0 16px;
    border-bottom: 1px solid #edf1f7;
    color: #2f4058;
    box-sizing: border-box;
}

.local-ai-context-picker-header strong {
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
    font-size: 15px;
    line-height: 20px;
}

.local-ai-context-picker-close {
    width: 24px;
    height: 24px;
    border: 0;
    background: transparent;
    color: #8da5c7;
    font-size: 28px;
    line-height: 22px;
    cursor: pointer;
}

.local-ai-context-picker-close:hover {
    color: #5aa9f2;
}

.local-ai-context-picker-controls {
    display: flex;
    gap: 8px;
    padding: 12px 14px 8px;
    background: #ffffff;
    box-sizing: border-box;
}

.local-ai-context-picker-module {
    width: 124px;
    height: 34px;
    border: 1px solid #e0e7f0;
    border-radius: 8px;
    background: #ffffff;
    color: #6f84a2;
    font-size: 12px;
    line-height: 32px;
    padding: 0 8px;
    box-sizing: border-box;
}

.local-ai-context-search {
    flex: 1;
    min-width: 0;
    height: 34px;
    border: 1px solid #e0e7f0;
    border-radius: 8px;
    background: #ffffff;
    color: #405a80;
    font-size: 13px;
    line-height: 18px;
    padding: 0 11px;
    box-sizing: border-box;
}

.local-ai-context-search:focus,
.local-ai-context-picker-module:focus {
    border-color: #5aa9f2;
    outline: none;
    box-shadow: 0 0 0 2px rgba(90, 169, 242, 0.12);
}

.local-ai-context-results {
    max-height: 318px;
    overflow-y: auto;
    padding: 6px 14px 14px;
    box-sizing: border-box;
}

.local-ai-context-result {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 54px;
    border: 0;
    border-radius: 9px;
    background: #ffffff;
    color: #405a80;
    text-align: left;
    padding: 8px 8px;
    cursor: pointer;
    box-sizing: border-box;
}

.local-ai-context-result:hover,
.local-ai-context-result:focus {
    background: #f6fbff;
    outline: none;
}

.local-ai-context-result-icon {
    width: 34px;
    height: 34px;
    border-radius: 5px;
    background: #f2f4f8;
    color: #9db3d3;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-size: 16px;
    line-height: 34px;
}

.local-ai-context-result-text {
    display: block;
    min-width: 0;
    padding-top: 1px;
}

.local-ai-context-result-text strong {
    display: block;
    color: #2f4058;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
    font-size: 13px;
    line-height: 17px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.local-ai-context-result-text em {
    display: block;
    margin-top: 2px;
    color: #7e8fa8;
    font-size: 12px;
    line-height: 16px;
    font-style: normal;
}

.local-ai-context-empty {
    padding: 16px 8px;
    color: #8fa0b6;
    font-size: 13px;
    line-height: 18px;
}

.local-ai-page-layout-full-mode .local-ai-context-picker {
    left: 34px;
    right: 34px;
}

@media screen and (max-width: 900px) {
    .local-ai-context-selected {
        padding: 0 16px 10px;
    }

    .local-ai-context-picker {
        left: 16px;
        right: 16px;
        bottom: 152px;
    }

    .local-ai-context-picker-controls {
        display: block;
    }

    .local-ai-context-picker-module,
    .local-ai-context-search {
        width: 100%;
    }

    .local-ai-context-search {
        margin-top: 8px;
    }
}

.local-ai-chat-card {
    position: relative;
}


.local-ai-welcome-prompts-hidden {
    padding-bottom: 28px;
}

.local-ai-welcome-prompts-hidden p {
    margin-bottom: 0;
}

.local-ai-context-result-single-line {
    align-items: center;
}

.local-ai-context-result-single-line .local-ai-context-result-text {
    padding-top: 0;
}

.local-ai-context-result-text {
    flex: 1 1 auto;
}

.local-ai-result-table th:first-child {
    border-top-left-radius: 8px;
}

.local-ai-result-table th:last-child {
    border-top-right-radius: 8px;
}

.local-ai-result-table tbody tr:nth-child(even) td {
    background: #f8fbff;
}

.local-ai-result-table td:first-child {
    color: #2f4058;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
}

/* AI Agent comparison response tables */
.local-ai-table-wrap {
    margin: 16px 0 18px;
    border: 1px solid #e3ecf6;
    border-radius: 0;
    background: #ffffff;
    overflow-x: auto;
    box-sizing: border-box;
}

.local-ai-result-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    table-layout: auto;
    background: #ffffff;
    color: #405a80;
    font-size: 14px;
    line-height: 19px;
}

.local-ai-result-table th,
.local-ai-result-table td {
    border: 1px solid #e3ecf6;
    box-sizing: border-box;
    vertical-align: middle;
    word-break: normal;
    overflow-wrap: break-word;
    hyphens: none;
}

.local-ai-result-table th {
    background: #5aa9f2;
    color: #ffffff;
    padding: 10px 14px;
    text-align: left;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
    font-weight: normal;
    white-space: normal;
}

.local-ai-result-table td {
    padding: 8px 14px;
    background: #ffffff;
}

.local-ai-result-table th:first-child,
.local-ai-result-table th:last-child {
    border-radius: 0;
}

.local-ai-result-table tbody tr:nth-child(even) td {
    background: #fbfdff;
}

.local-ai-result-table td:first-child {
    color: #2f4058;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
}

.local-ai-comparison-table-wrap {
    border-color: #dfeaf5;
    box-shadow: 0 1px 0 rgba(31, 52, 80, 0.02);
}

.local-ai-comparison-table {
    min-width: 560px;
    table-layout: fixed;
}

.local-ai-comparison-table th,
.local-ai-comparison-table td {
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    hyphens: none;
}

.local-ai-comparison-table th:first-child,
.local-ai-comparison-table td:first-child {
    width: 27%;
    min-width: 118px;
}

.local-ai-comparison-table td:not(:first-child) b,
.local-ai-comparison-table td:not(:first-child) strong {
    color: #79c943;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
    font-weight: normal;
}

.local-ai-comparison-table td em {
    color: #6f84a2;
    font-style: normal;
}

.local-ai-floating-panel .local-ai-table-wrap {
    margin: 14px 0 16px;
}

.local-ai-floating-panel .local-ai-result-table {
    font-size: 13px;
    line-height: 18px;
}

.local-ai-floating-panel .local-ai-result-table th {
    padding: 9px 12px;
}

.local-ai-floating-panel .local-ai-result-table td {
    padding: 7px 12px;
}

.local-ai-floating-panel .local-ai-comparison-table {
    min-width: 480px;
    border: 1px solid #EAF2FA;
}

.local-ai-page .local-ai-comparison-table {
    min-width: 680px;
}

/* AI Agent dynamic examples and send icon */
.local-ai-send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.local-ai-send-icon,
.local-ai-send img {
    width: 18px;
    height: 18px;
    display: block;
    margin: 0 auto;
    pointer-events: none;
}

.local-ai-send.loading .local-ai-send-icon,
.local-ai-send.loading img {
    display: none;
}

.local-ai-welcome-prompts,
.local-ai-side-examples {
    width: 100%;
}

.local-ai-prompt-card.local-ai-example,
.local-ai-example.local-ai-prompt-card {
    align-items: center;
}

.local-ai-prompt-icon {
    min-width: 24px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 32px;
    text-align: center;
    margin-top: 0;
}

.local-ai-side-example {
    display: flex !important;
    align-items: center;
    gap: 12px;
    min-height: 64px;
}

.local-ai-side-example > span:last-child {
    display: block;
    min-width: 0;
}

.local-ai-side-example strong {
    display: block;
    margin: 0 0 3px;
    color: #5aa9f2;
    text-transform: uppercase;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
    font-size: 11px;
    line-height: 15px;
}

.local-ai-side-example em {
    display: block;
    color: #405a80;
    font-size: 14px;
    line-height: 19px;
    font-style: normal;
}

.local-ai-side-card .local-ai-side-example:hover em {
    color: #405a80;
}


/* AI details sidebar conversation interactions */
.local-ai-conversation-row {
    position: relative;
    align-items: center;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

.local-ai-conversation {
    position: relative;
    overflow: hidden;
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, color 0.18s ease;
}

.local-ai-conversation:before {
    content: '';
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 0;
    width: 3px;
    border-radius: 0 4px 4px 0;
    background: #5aa9f2;
    opacity: 0;
    transform: scaleY(0.5);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.local-ai-conversation-row:hover .local-ai-conversation,
.local-ai-conversation:focus {
    border-color: #b9d9f7;
    background: #fbfdff;
    box-shadow: 0 10px 24px rgba(31, 52, 80, 0.08);
    transform: translateX(2px);
    outline: none;
}

.local-ai-conversation-row:hover .local-ai-conversation:before,
.local-ai-conversation:focus:before,
.local-ai-conversation-row.active .local-ai-conversation:before,
.local-ai-conversation-row.selected .local-ai-conversation:before {
    opacity: 1;
    transform: scaleY(1);
}

.local-ai-conversation-row.active .local-ai-conversation,
.local-ai-conversation-row.selected .local-ai-conversation {
    border-color: #b9d9f7;
    background: linear-gradient(90deg, #f1f8ff 0%, #ffffff 100%);
    box-shadow: inset 0 0 0 1px rgba(90, 169, 242, 0.08);
}

.local-ai-conversation-row.active .local-ai-conversation strong,
.local-ai-conversation-row.selected .local-ai-conversation strong,
.local-ai-conversation-row:hover .local-ai-conversation strong {
    color: #2f91d8;
}

.local-ai-conversation-delete {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    opacity: 0.58;
    transform: scale(0.96);
    transition: opacity 0.18s ease, transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.local-ai-conversation-row:hover .local-ai-conversation-delete,
.local-ai-conversation-delete:focus {
    opacity: 1;
    transform: scale(1);
    outline: none;
}

.local-ai-conversation-delete:hover,
.local-ai-conversation-delete:focus {
    border-color: #ffd6d0;
    background: #fff5f3;
    color: #d85b4b;
    box-shadow: 0 8px 18px rgba(216, 91, 75, 0.14);
}

.local-ai-confirm-overlay {
    position: fixed;
    z-index: 487;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(31, 52, 80, 0.34);
    font-family: 'AvenirNext', Arial, sans-serif;
}

.local-ai-confirm-dialog {
    width: 360px;
    max-width: calc(100vw - 34px);
    padding: 22px;
    border: 1px solid #edf1f7;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 24px 54px rgba(31, 52, 80, 0.26);
    color: #405a80;
    box-sizing: border-box;
    animation: localAiConfirmIn 0.18s ease both;
}

.local-ai-confirm-dialog strong {
    display: block;
    color: #2f4058;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
    font-size: 18px;
    line-height: 23px;
}

.local-ai-confirm-dialog p {
    margin: 9px 0 18px;
    color: #8fa0b6;
    font-size: 13px;
    line-height: 19px;
}

.local-ai-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.local-ai-confirm-actions button {
    height: 34px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid #dbe8f8;
    background: #ffffff;
    color: #5aa9f2;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
    cursor: pointer;
}

.local-ai-confirm-actions .local-ai-confirm-delete {
    border-color: #d85b4b;
    background: #d85b4b;
    color: #ffffff;
}

.local-ai-confirm-actions button:hover,
.local-ai-confirm-actions button:focus {
    outline: none;
    box-shadow: 0 8px 18px rgba(31, 52, 80, 0.12);
}

@keyframes localAiConfirmIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#local_ai_new_conversation {
    position: relative;
    overflow: hidden;
    transform: translateZ(0);
    transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease, color 160ms ease;
    will-change: transform;
}

#local_ai_new_conversation:before {
    content: "";
    position: absolute;
    top: 0;
    left: -80%;
    width: 52%;
    height: 100%;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0));
    pointer-events: none;
}

#local_ai_new_conversation:hover,
#local_ai_new_conversation:focus {
    box-shadow: 0 1px 10px rgba(24, 37, 76, 0.11);
}

#local_ai_new_conversation:hover:before,
#local_ai_new_conversation:focus:before {
    left: 130%;
}

#local_ai_new_conversation:active {
    box-shadow: 0 3px 10px rgba(24, 37, 76, 0.11);
}

/* Focused AI requests and answer actions, shared by page and floating chat. */
.local-ai-request-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 20px 8px;
    background: #fff;
    color: #3b506a;
    font-size: 12px;
    flex-wrap: wrap;
}
.local-ai-request-tools label {
    margin: 0;
}
.local-ai-request-type {
    flex: 1 1 160px;
    min-width: 0;
    max-width: 280px;
    min-height: 34px;
    padding: 6px 9px;
    border: 1px solid #d5deea;
    border-radius: 6px;
    background: #fff;
    color: #2d4563;
    font: inherit;
}
.local-ai-focus-prompt,
.local-ai-copy-answer {
    padding: 6px 10px;
    border: 1px solid #d5deea;
    border-radius: 6px;
    background: #f7f9fc;
    color: #2d4563;
    font: inherit;
    cursor: pointer;
}
.local-ai-focus-prompt:hover,
.local-ai-copy-answer:hover {
    border-color: #8aa5c4;
    background: #edf4fc;
}
.local-ai-request-tools :focus-visible,
.local-ai-copy-answer:focus-visible,
.local-ai-send:focus-visible {
    outline: 2px solid #2475b8;
    outline-offset: 2px;
}
.local-ai-context-hint,
.local-ai-request-status {
    padding: 0 20px 8px;
    background: #fff;
    color: #566b83;
    font-size: 12px;
    line-height: 1.5;
}
.local-ai-request-status:empty { display: none; }
.local-ai-answer-actions {
    display: flex;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid #e9eef5;
    font-size: 12px;
}
.local-ai-coverage-note {
    margin-top: 8px;
    padding: 9px 11px;
    border-left: 3px solid #8aa5c4;
    border-radius: 3px;
    background: #f4f7fb;
    color: #435b76;
    font-size: 12px;
    line-height: 1.5;
    max-height: 96px;
    overflow-y: auto;
}
.local-ai-thinking-note {
    margin-top: 6px;
    color: #566b83;
    font-size: 12px;
}
.local-ai-copy-buffer { position: fixed; left: -10000px; top: 0; }
.local-ai-input { max-height: 160px; box-sizing: border-box; }
.local-ai-message-inner { overflow-wrap: anywhere; }
.local-ai-floating-panel {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}
.local-ai-floating-panel > :not(.local-ai-messages) { flex-shrink: 0; }
.local-ai-floating-panel > .local-ai-messages { flex: 1 1 auto; min-height: 100px; }
@media screen and (max-width: 600px) {
    .local-ai-request-tools { gap: 6px; padding-left: 12px; padding-right: 12px; }
    .local-ai-context-hint, .local-ai-request-status { padding-left: 12px; padding-right: 12px; }
    .local-ai-request-type { max-width: none; }
    .local-ai-floating { right: 12px; bottom: 12px; }
    .local-ai-floating-panel { width: calc(100vw - 24px); max-width: 480px; max-height: calc(100vh - 96px); }
}
@media (prefers-reduced-motion: reduce) {
    .local-ai-step-active-dot, .local-ai-thinking * { animation: none !important; }
}

/* Compact context controls and response feedback. Remove this rule to restore the floating status. */
#local_ai_floating_request_status { display: none !important; }
.local-ai-context-row { flex-wrap: wrap; }
.local-ai-context-pill { flex-wrap: nowrap; }
.local-ai-context-pill > strong { max-width: 190px; }
.local-ai-sources-summary .local-ai-used-context { max-width: calc(100% - 40px); }
.local-ai-context-pill .local-ai-request-tools {
    display: inline-flex; flex: 0 1 auto; flex-wrap: nowrap; gap: 3px;
    padding: 0; background: transparent; min-width: 0;
}
.local-ai-context-pill .local-ai-request-type {
    flex: 1 1 115px; width: 115px; max-width: 160px; min-width: 127px; min-height: 28px;
    padding: 3px 5px; font-size: 11px;
}
.local-ai-icon-button {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; flex: 0 0 28px; padding: 0; margin: 0;
    border: 1px solid transparent; border-radius: 6px; background: transparent;
    color: #7890ac; font-size: 13px; line-height: 1; cursor: pointer;
    transition: color 150ms ease, background 150ms ease, border-color 150ms ease, transform 150ms ease;
}
.local-ai-icon-button:hover:not(:disabled), .local-ai-icon-button:focus-visible {
    color: #258fdc; background: #e8f3fd; border-color: #c5e2fb; transform: translateY(-1px);
}
.local-ai-icon-button:active:not(:disabled) { color: #2076b5; background: #d9ecff; transform: scale(.94); }
.local-ai-icon-button.is-active { color: #258fdc; background: #e8f3fd; }
.local-ai-icon-button:focus-visible, .local-ai-feedback-form button:focus-visible {
    outline: 2px solid #2475b8; outline-offset: 2px;
}
.local-ai-icon-button:disabled { opacity: .4; cursor: default; }
.local-ai-icon-button.local-ai-coverage-note { overflow: visible; max-height: none; }
.local-ai-answer-actions { align-items: center; flex-wrap: wrap; gap: 4px; }
.local-ai-feedback-buttons { display: inline-flex; align-items: center; gap: 3px; }
.local-ai-feedback-status { color: #566b83; font-size: 11px; }
.local-ai-feedback-form { flex: 0 0 100%; margin-top: 5px; }
.local-ai-feedback-comment {
    box-sizing: border-box; width: 100%; min-height: 65px; padding: 8px;
    resize: vertical; border: 1px solid #d5deea; border-radius: 6px; font: inherit; color: #2d4563;
}
.local-ai-feedback-form-actions { display: flex; gap: 6px; margin-top: 5px; }
.local-ai-feedback-form button {
    padding: 5px 9px; border: 1px solid #d5deea; border-radius: 5px;
    background: #f7f9fc; color: #2d4563; font: inherit; cursor: pointer;
}
.local-ai-feedback-form button:hover:not(:disabled) { background: #e8f3fd; color: #258fdc; }
@media (prefers-reduced-motion: reduce) {
    .local-ai-icon-button { transition: none; }
    .local-ai-icon-button:hover, .local-ai-icon-button:active { transform: none; }
}

/* Recipe Improvements: professional description styling. */
.recipe-ai-answer-content .recipe-ai-summary.recipe-ai-description {
    box-sizing: border-box;
    margin: 0 0 18px;
    padding: 14px 16px;
    border: 1px solid #dce7f2;
    border-left: 4px solid #3b87bd;
    border-radius: 9px;
    background: #f8fbfe;
    color: #334c66;
    font-size: 13px;
    line-height: 1.72;
    overflow-wrap: anywhere;
}
.recipe-ai-answer-content .recipe-ai-summary.recipe-ai-description strong {
    color: #244d70;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
    font-weight: normal;
}
.recipe-ai-answer-content .recipe-ai-summary.recipe-ai-description br + br {
    line-height: 2.1;
}

/* Recipe Improvements: distinguish the submitted prompt from the AI response. */
#recipe_ai_improvement_requested_text.recipe-ai-submitted-request {
    box-sizing: border-box;
    clear: both;
    width: 100%;
    margin: 14px 0 18px;
    border: 1px solid #c5d8eb;
    border-left: 4px solid #3b87bd;
    border-radius: 8px;
    background: #f5f9fd;
    color: #2d4563;
    box-shadow: 0 2px 6px rgba(45, 69, 99, 0.06);
}
#recipe_ai_improvement_requested_text .recipe-ai-submitted-request-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 4px 14px;
    border-bottom: 1px solid #dce7f2;
    border-radius: 7px 7px 0 0;
    background: #eaf2fa;
}
#recipe_ai_improvement_requested_text .recipe-ai-submitted-request-header strong {
    font-size: 12px;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
    line-height: 1.5;
    color: #294b6b;
}
#recipe_ai_improvement_requested_text .recipe-ai-restore-request {
    float: none;
    width: auto;
    height: auto;
    margin: 0;
    padding: 5px 10px;
    border: 1px solid #bfd2e5;
    border-radius: 5px;
    background: #ffffff;
    color: #285c84;
    font: inherit;
    font-size: 12px;
    line-height: 1.5;
    cursor: pointer;
}
#recipe_ai_improvement_requested_text .recipe-ai-restore-request:hover {
    border-color: #84afd1;
    background: #dcecf9;
}
#recipe_ai_improvement_requested_text .recipe-ai-restore-request:focus,
#recipe_ai_improvement_requested_text .recipe-ai-submitted-request-body:focus {
    outline: 2px solid #2475b8;
    outline-offset: 2px;
}
#recipe_ai_improvement_requested_text .recipe-ai-submitted-request-body {
    box-sizing: border-box;
    max-height: 220px;
    margin: 0;
    padding: 13px 14px 15px;
    overflow-y: auto;
    overflow-wrap: anywhere;
    word-wrap: break-word;
    white-space: pre-wrap;
    font-size: 13px;
    line-height: 1.65;
    color: #334c66;
    scrollbar-width: thin;
    scrollbar-color: #9bb8d0 #edf3f9;
}
@media screen and (max-width: 600px) {
    #recipe_ai_improvement_requested_text .recipe-ai-submitted-request-header {
        padding: 4px 11px;
    }
    #recipe_ai_improvement_requested_text .recipe-ai-submitted-request-body {
        max-height: 180px;
        padding: 11px;
    }
}

/* Recipe Improvements response feedback */
.recipe-ai-response-feedback {
    margin-top: 18px;
    padding: 13px 14px;
    border: 1px solid #dfe8f2;
    border-radius: 10px;
    background: #f8fbfe;
    color: #405a80;
    box-sizing: border-box;
}

.recipe-ai-feedback-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
    line-height: 18px;
    font-family: 'AvenirLTStdMedium', Arial, sans-serif;
}

.recipe-ai-feedback-buttons {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex: 0 0 auto;
}

.recipe-ai-feedback-status {
    display: block;
    color: #7890ac;
    font-size: 11px;
    line-height: 15px;
}

.recipe-ai-feedback-form {
    margin-top: 7px;
}

.recipe-ai-feedback-comment {
    width: 100%;
    min-height: 62px;
    max-height: 150px;
    resize: vertical;
    padding: 8px 10px;
    border: 1px solid #dce5ef;
    border-radius: 8px;
    background: #ffffff;
    color: #405a80;
    box-sizing: border-box;
    font-family: 'AvenirNext', Arial, sans-serif;
    font-size: 12px;
    line-height: 17px;
}

.recipe-ai-feedback-comment:focus {
    border-color: #5aa9f2;
    box-shadow: 0 0 0 2px rgba(90, 169, 242, 0.12);
    outline: 0;
}

.recipe-ai-feedback-form-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.recipe-ai-feedback-form-actions button {
    padding: 5px 10px 4px 10px;
    border: 1px solid #dce5ef;
    border-radius: 6px;
    background: #ffffff;
    color: #405a80;
    cursor: pointer;
    font-family: 'AvenirNext', Arial, sans-serif;
    font-size: 11px;
}

.recipe-ai-feedback-form-actions button:hover:not(:disabled) {
    border-color: #bcd8ee;
    background: #eaf5fe;
    color: #258fdc;
}

.recipe-ai-feedback-form-actions button:disabled,
.recipe-ai-response-feedback .local-ai-icon-button:disabled {
    opacity: 0.45;
    cursor: default;
}

@media screen and (max-width: 640px) {
    .recipe-ai-feedback-heading {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* Shared AI motion styles, included in both AI entry stylesheets. */
.fs-ai-typing-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 28px;
    height: 18px;
    vertical-align: middle;
    color: inherit;
}
.fs-ai-typing-dots > i {
    display: block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    animation: fs-ai-typing 1.2s ease-in-out infinite;
}
.fs-ai-typing-dots > i:nth-child(2) { animation-delay: 0.16s; }
.fs-ai-typing-dots > i:nth-child(3) { animation-delay: 0.32s; }
.fs-ai-reveal-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 5px 0 9px;
    color: #566b83;
    font-size: 12px;
    line-height: 18px;
}
.fs-ai-show-answer {
    border: 1px solid #c7d6e5;
    border-radius: 6px;
    padding: 3px 8px;
    background: #fff;
    color: #365878;
    font: inherit;
    cursor: pointer;
}
.fs-ai-show-answer:hover { background: #edf4fc; }
.fs-ai-show-answer:focus-visible { outline: 2px solid #2475b8; outline-offset: 2px; }
.fs-ai-revealing {
    overflow: hidden !important;
    overflow-anchor: none;
    pointer-events: none;
    user-select: none;
}
.local-ai-answer-content, .cockpit-ai-message-content, .recipe-ai-answer-content { display: flow-root; }
@keyframes fs-ai-typing {
    0%, 65%, 100% { opacity: 0.38; transform: translateY(0); }
    32% { opacity: 1; transform: translateY(-4px); }
}
@keyframes fs-ai-enter {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fs-ai-field-pulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(61, 164, 241, 0.12); }
    50% { box-shadow: 0 0 0 3px rgba(61, 164, 241, 0.28); }
}
@keyframes fs-ai-field-applied {
    from { outline-color: #5aa9f2; }
    to { outline-color: transparent; }
}
@media (prefers-reduced-motion: reduce) {
    .fs-ai-typing-dots > i { animation: none !important; opacity: 0.7; transform: none; }
    .fs-ai-revealing { max-height: none !important; }
    .fs-ai-show-answer { transition: none; }
}

/* Motion is scoped to AI controls and newly opened panels. */
.local-ai-thinking .local-ai-step-row { display: flex; align-items: center; gap: 8px; color: #405a80; }
.local-ai-thinking .fs-ai-typing-dots { color: #4b91c8; }
.local-ai-thinking, .local-ai-sources-panel, .local-ai-context-picker,
.local-ai-feedback-form, .recipe-ai-feedback-form, .local-ai-confirm-dialog {
    animation: fs-ai-enter 180ms ease-out both;
}
.local-ai-answer-content.fs-ai-revealing ~ .local-ai-answer-actions { display: none; }
.recipe-ai-answer-content.fs-ai-revealing ~ .recipe-ai-response-feedback { display: none; }
.local-ai-context-menu-tools.loading:after { display: none; }
.local-ai-context-menu-progress {
    display: flex; align-items: center; gap: 7px; padding: 10px 12px;
    border-top: 1px solid #eef3f8; background: #fbfcfe; color: #526c8b; font-size: 12px;
}
.local-ai-context-field-loading { animation: fs-ai-field-pulse 1.5s ease-in-out infinite; }
.local-ai-context-field-applied { outline: 2px solid transparent; outline-offset: 2px; animation: fs-ai-field-applied 650ms ease-out; }
@media (prefers-reduced-motion: reduce) {
    .local-ai-thinking, .local-ai-sources-panel, .local-ai-context-picker,
    .local-ai-feedback-form, .recipe-ai-feedback-form, .local-ai-confirm-dialog,
    .local-ai-context-field-loading, .local-ai-context-field-applied { animation: none !important; }
    .local-ai-floating *, .local-ai-page *, .local-ai-context-menu-tools * { transition: none !important; }
}

/* Blue AI scrollbars, matching Flavor Studio Publish styling */
.local-ai-floating *,
.local-ai-page *,
.local-ai-context-menu-tools *,
[class^="local-ai-"] *,
[class*=" local-ai-"] *,
[class^="recipe-ai-"] *,
[class*=" recipe-ai-"] * {
    scrollbar-width: thin;
    scrollbar-color: #3DA4F1 #F9F9FB;
}

.local-ai-floating *::-webkit-scrollbar,
.local-ai-page *::-webkit-scrollbar,
.local-ai-context-menu-tools *::-webkit-scrollbar,
[class^="local-ai-"] *::-webkit-scrollbar,
[class*=" local-ai-"] *::-webkit-scrollbar,
[class^="recipe-ai-"] *::-webkit-scrollbar,
[class*=" recipe-ai-"] *::-webkit-scrollbar {
    width: 7px;
    height: 7px;
    cursor: pointer;
}

.local-ai-floating *::-webkit-scrollbar-track,
.local-ai-page *::-webkit-scrollbar-track,
.local-ai-context-menu-tools *::-webkit-scrollbar-track,
[class^="local-ai-"] *::-webkit-scrollbar-track,
[class*=" local-ai-"] *::-webkit-scrollbar-track,
[class^="recipe-ai-"] *::-webkit-scrollbar-track,
[class*=" recipe-ai-"] *::-webkit-scrollbar-track {
    background: #F9F9FB;
    cursor: pointer;
}

.local-ai-floating *::-webkit-scrollbar-thumb,
.local-ai-page *::-webkit-scrollbar-thumb,
.local-ai-context-menu-tools *::-webkit-scrollbar-thumb,
[class^="local-ai-"] *::-webkit-scrollbar-thumb,
[class*=" local-ai-"] *::-webkit-scrollbar-thumb,
[class^="recipe-ai-"] *::-webkit-scrollbar-thumb,
[class*=" recipe-ai-"] *::-webkit-scrollbar-thumb,
.local-ai-floating *::-webkit-scrollbar-thumb:window-inactive,
.local-ai-page *::-webkit-scrollbar-thumb:window-inactive,
.local-ai-context-menu-tools *::-webkit-scrollbar-thumb:window-inactive,
[class^="local-ai-"] *::-webkit-scrollbar-thumb:window-inactive,
[class*=" local-ai-"] *::-webkit-scrollbar-thumb:window-inactive,
[class^="recipe-ai-"] *::-webkit-scrollbar-thumb:window-inactive,
[class*=" recipe-ai-"] *::-webkit-scrollbar-thumb:window-inactive {
    background: #3DA4F1;
}

.local-ai-floating *::-webkit-scrollbar-corner,
.local-ai-page *::-webkit-scrollbar-corner,
.local-ai-context-menu-tools *::-webkit-scrollbar-corner,
[class^="local-ai-"] *::-webkit-scrollbar-corner,
[class*=" local-ai-"] *::-webkit-scrollbar-corner,
[class^="recipe-ai-"] *::-webkit-scrollbar-corner,
[class*=" recipe-ai-"] *::-webkit-scrollbar-corner {
    background: #F9F9FB;
}

/* AI question suggestion refresh control. */
.local-ai-try-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.local-ai-refresh-examples {
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #7890ac;
    cursor: pointer;
    font-size: 12px;
    line-height: 24px;
    text-align: center;
    flex: 0 0 26px;
    transition: color 150ms ease, background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.local-ai-refresh-examples:hover,
.local-ai-refresh-examples:focus-visible {
    color: #258fdc;
    background: #e8f3fd;
    border-color: #c5e2fb;
}

.local-ai-refresh-examples:active {
    transform: rotate(35deg);
}

@media (prefers-reduced-motion: reduce) {
    .local-ai-refresh-examples {
        transition: none;
    }
    .local-ai-refresh-examples:active {
        transform: none;
    }
}
