.ai-assistant-button {
    position: fixed;
    right: 22px;
    bottom: 22px;
    width: 62px;
    height: 62px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #101827, #0f766e);
    color: #fff;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .32);
    z-index: 1060;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
}

.ai-assistant-button span {
    margin-top: 3px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
}

.ai-robot-face {
    position: relative;
    width: 28px;
    height: 22px;
    border: 2px solid currentColor;
    border-radius: 8px;
    display: inline-block;
}

.ai-robot-face::before {
    content: "";
    position: absolute;
    top: -8px;
    left: 50%;
    width: 2px;
    height: 7px;
    background: currentColor;
    transform: translateX(-50%);
}

.ai-robot-face::after {
    content: "";
    position: absolute;
    top: -11px;
    left: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    transform: translateX(-50%);
}

.ai-robot-face span::before,
.ai-robot-face span::after {
    content: "";
    position: absolute;
    top: 7px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}

.ai-robot-face span::before {
    left: 6px;
}

.ai-robot-face span::after {
    right: 6px;
}

.ai-robot-face.is-small {
    width: 24px;
    height: 19px;
}

.ai-assistant-panel {
    position: fixed;
    right: 22px;
    bottom: 94px;
    width: min(460px, calc(100vw - 32px));
    height: min(700px, calc(100vh - 122px));
    background: #fff;
    border: 1px solid #cfd8e3;
    box-shadow: 0 20px 54px rgba(15, 23, 42, .26);
    z-index: 1060;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.ai-assistant-panel.is-open {
    display: flex;
}

.ai-assistant-header {
    min-height: 70px;
    padding: 12px 14px;
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    align-items: center;
    gap: 10px;
    background: #101827;
    color: #fff;
}

.ai-assistant-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.ai-assistant-title strong,
.ai-assistant-title small {
    display: block;
}

.ai-assistant-title strong {
    font-size: 14px;
    line-height: 1.2;
}

.ai-assistant-title small {
    color: #a7f3d0;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-assistant-mark {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #0f766e;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex: 0 0 auto;
}

.ai-status-pill {
    border: 1px solid rgba(255,255,255,.28);
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 11px;
    color: #e5e7eb;
    white-space: nowrap;
}

.ai-status-pill.is-ready {
    background: #064e3b;
    color: #d1fae5;
}

.ai-status-pill.is-local {
    background: #42351f;
    color: #fde68a;
}

.ai-assistant-close {
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 18px;
    width: 32px;
    height: 32px;
}

.ai-assistant-header-btn {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255,255,255,.24);
    border-radius: 8px;
    background: rgba(255,255,255,.08);
    color: #fff;
}

.ai-assistant-context {
    padding: 9px 12px;
    font-size: 12px;
    background: #eef7f6;
    color: #115e59;
    border-bottom: 1px solid #d7dde8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-assistant-messages {
    flex: 1;
    overflow: auto;
    padding: 14px;
    background: #f7f9fc;
}

.ai-msg {
    max-width: 94%;
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.45;
    white-space: pre-wrap;
}

.ai-msg-user {
    margin-left: auto;
    background: #0f766e;
    color: #fff;
}

.ai-msg-assistant {
    margin-right: auto;
    background: #fff;
    border: 1px solid #dbe3ee;
    color: #1f2937;
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 8px;
    align-items: start;
}

.ai-msg-avatar {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: #e6f7f4;
    color: #0f766e;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.ai-msg-text {
    min-width: 0;
}

.ai-config-card,
.ai-action-card {
    margin: 10px 0;
    padding: 12px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
}

.ai-config-card {
    display: grid;
    grid-template-columns: 34px 1fr auto;
    gap: 10px;
    align-items: center;
    border-color: #f59e0b;
    background: #fffbeb;
}

.ai-config-card p {
    margin: 3px 0 0;
    font-size: 12px;
    color: #6b4e16;
}

.ai-config-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #f59e0b;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ai-action-card h6 {
    margin: 0 0 6px;
    font-size: 13px;
    color: #0f172a;
}

.ai-action-card p,
.ai-action-card li {
    font-size: 12px;
}

.ai-defaults-note {
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    background: #eef7f6;
    color: #115e59;
    font-size: 11px;
}

.ai-existing-patient-note {
    margin-top: 10px;
    padding: 10px;
    display: grid;
    gap: 4px;
    border: 1px solid #99f6e4;
    border-radius: 6px;
    background: #ecfeff;
    color: #134e4a;
}

.ai-existing-patient-note strong {
    font-size: 12px;
    color: #0f766e;
}

.ai-existing-patient-note span {
    font-size: 13px;
    font-weight: 700;
}

.ai-existing-patient-note em {
    font-size: 11px;
    font-style: normal;
    color: #0f766e;
}

.ai-duplicate-patient-preview {
    margin-top: 10px;
    padding: 9px 10px;
    border: 1px solid #fed7aa;
    border-radius: 6px;
    background: #fff7ed;
}

.ai-duplicate-patient-preview strong {
    display: block;
    margin-bottom: 6px;
    color: #9a3412;
    font-size: 12px;
}

.ai-duplicate-patient-item {
    width: 100%;
    display: block;
    margin-top: 5px;
    padding: 7px 8px;
    border: 1px solid #fdba74;
    border-radius: 6px;
    background: #fff;
    color: #7c2d12;
    font-size: 11px;
    text-align: left;
}

.ai-duplicate-patient-item.is-selected {
    border-color: #ea580c;
    background: #ffedd5;
    font-weight: 700;
}

.ai-transaction-context {
    margin-top: 10px;
    padding: 8px 10px;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    background: #eff6ff;
    color: #1e3a8a;
    font-size: 11px;
    font-weight: 700;
}

.ai-medical-info-preview {
    margin-top: 10px;
    padding: 9px 10px;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    background: #f0f9ff;
}

.ai-test-preview {
    margin-top: 10px;
    padding: 9px 10px;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    background: #f0fdf4;
}

.ai-test-preview strong {
    display: block;
    margin-bottom: 6px;
    color: #166534;
    font-size: 12px;
}

.ai-test-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 5px 0;
    font-size: 12px;
}

.ai-test-item + .ai-test-item {
    border-top: 1px solid #dcfce7;
}

.ai-test-item em {
    font-style: normal;
    color: #166534;
    font-size: 11px;
    white-space: nowrap;
}

.ai-test-item.is-missing em {
    color: #b91c1c;
}

.ai-workflow-preview {
    margin-top: 10px;
    padding: 10px;
    border: 1px solid #ddd6fe;
    border-radius: 6px;
    background: #f5f3ff;
}

.ai-workflow-preview > strong {
    display: block;
    margin-bottom: 7px;
    color: #5b21b6;
    font-size: 12px;
}

.ai-workflow-step {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 8px;
    align-items: start;
    padding: 7px 0;
    border-top: 1px solid #e9d5ff;
}

.ai-workflow-step:first-of-type {
    border-top: 0;
}

.ai-workflow-index {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #ede9fe;
    color: #5b21b6;
    font-size: 11px;
    font-weight: 700;
}

.ai-workflow-step b,
.ai-workflow-step small,
.ai-workflow-step em {
    display: block;
}

.ai-workflow-step b {
    font-size: 12px;
    color: #312e81;
}

.ai-workflow-step small {
    font-size: 10px;
    color: #6d28d9;
}

.ai-workflow-step em {
    margin-top: 2px;
    font-size: 11px;
    font-style: normal;
    color: #475569;
}

.ai-workflow-step.is-write .ai-workflow-index {
    background: #fef3c7;
    color: #92400e;
}

.ai-report-options {
    margin-top: 10px;
    padding: 10px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    border-radius: 8px;
}

.ai-report-options strong {
    display: block;
    color: #0f172a;
    margin-bottom: 8px;
    font-size: 12px;
}

.ai-report-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.ai-report-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 5px 8px;
    border: 1px solid #cbd5e1;
    background: #fff;
    border-radius: 6px;
    color: #334155;
    font-size: 12px;
}

.ai-medical-info-preview strong {
    display: block;
    margin-bottom: 6px;
    color: #075985;
    font-size: 12px;
}

.ai-medical-info-item {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 0;
    font-size: 12px;
    color: #0f172a;
}

.ai-medical-info-item + .ai-medical-info-item {
    border-top: 1px solid #dbeafe;
}

.ai-medical-info-item em {
    font-style: normal;
    color: #0369a1;
    font-size: 11px;
    white-space: nowrap;
}

.ai-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}

.ai-form-grid label {
    font-size: 11px;
    color: #475569;
    margin-bottom: 3px;
}

.ai-form-grid input,
.ai-assistant-input textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 7px 8px;
    font-size: 12px;
}

.ai-action-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 10px;
}

.ai-assistant-input {
    border-top: 1px solid #d7dde8;
    padding: 10px;
    background: #fff;
}

.ai-assistant-input-row {
    display: flex;
    gap: 8px;
}

.ai-assistant-input textarea {
    min-height: 44px;
    max-height: 120px;
    resize: vertical;
}

.ai-assistant-send,
.ai-assistant-voice {
    width: 44px;
    min-width: 44px;
    border: 0;
    border-radius: 6px;
    color: #fff;
}

.ai-assistant-send {
    background: #0f766e;
}

.ai-assistant-voice {
    background: #334155;
}

.ai-assistant-voice.is-recording {
    background: #dc2626;
}

.ai-assistant-small {
    font-size: 11px;
    color: #64748b;
    margin-top: 6px;
}

@media (max-width: 575px) {
    .ai-assistant-panel {
        right: 8px;
        bottom: 82px;
        width: calc(100vw - 16px);
        height: calc(100vh - 98px);
    }

    .ai-assistant-button {
        right: 14px;
        bottom: 14px;
    }

    .ai-form-grid,
    .ai-config-card {
        grid-template-columns: 1fr;
    }
}
