.ai-helper { display: none; }

@media (min-width: 681px) {
    .ai-helper { display: block; position: fixed; right: 22px; bottom: 22px; z-index: 1200; }
    .ai-helper-launcher { align-items: center; background: var(--nav, #183247); border: 0; border-radius: 999px; box-shadow: 0 8px 28px rgba(24, 50, 71, .24); color: #fff; cursor: pointer; display: flex; font: inherit; font-weight: 700; gap: 8px; padding: 12px 18px; }
    .ai-helper-launcher span { align-items: center; background: rgba(255,255,255,.18); border-radius: 50%; display: inline-flex; height: 24px; justify-content: center; width: 24px; }
    .ai-helper-panel { background: #fff; border: 1px solid #d9e3df; border-radius: 14px; bottom: 0; box-shadow: 0 18px 60px rgba(15, 42, 35, .28); display: grid; grid-template-rows: auto minmax(150px, 1fr) auto auto auto; max-height: min(680px, calc(100vh - 44px)); overflow: hidden; position: absolute; right: 0; width: min(430px, calc(100vw - 44px)); }
    .ai-helper-panel[hidden] { display: none; }
    .ai-helper-panel header { align-items: center; background: var(--nav, #183247); color: #fff; display: flex; justify-content: space-between; padding: 14px 16px; }
    .ai-helper-panel header div { display: grid; gap: 2px; }
    .ai-helper-panel header small { color: #dce8f1; }
    .ai-helper-panel header button { background: transparent; border: 0; color: #fff; cursor: pointer; font-size: 25px; }
    .ai-helper-messages { background: #f6f8f7; display: grid; gap: 10px; overflow-y: auto; padding: 14px; }
    .ai-helper-message { border-radius: 10px; line-height: 1.45; max-width: 88%; padding: 10px 12px; white-space: pre-wrap; }
    .ai-helper-message.assistant { background: #fff; border: 1px solid #dce5e1; justify-self: start; }
    .ai-helper-message.user { background: #dce8f1; justify-self: end; }
    .ai-helper-message.error { background: #fff0ef; border: 1px solid #efc4bf; color: #8b2720; }
    .ai-helper-suggestions { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px 0; }
    .ai-helper-suggestions button { background: #edf3f8; border: 1px solid #c8d8e5; border-radius: 999px; color: var(--nav, #183247); cursor: pointer; padding: 6px 9px; }
    .ai-helper-panel form { display: grid; gap: 6px; padding: 12px 14px; }
    .ai-helper-panel form label { font-size: 12px; font-weight: 700; }
    .ai-helper-panel textarea { min-height: 74px; resize: vertical; }
    .ai-helper-panel form > div { align-items: center; display: flex; justify-content: space-between; }
    .ai-helper-panel form button { background: var(--nav, #183247); border: 0; border-radius: 6px; color: #fff; cursor: pointer; font-weight: 700; padding: 9px 16px; }
    .ai-helper-note { border-top: 1px solid #e3e9e6; color: #63736d; font-size: 11px; margin: 0; padding: 9px 14px; }
}

@media (min-width: 681px) and (max-width: 900px) {
    body.ai-helper-open { overflow: hidden; }
    .ai-helper { bottom: max(14px, env(safe-area-inset-bottom)); right: max(14px, env(safe-area-inset-right)); }
    .ai-helper-launcher { min-height: 48px; padding: 12px 16px; }
    .ai-helper-panel {
        bottom: max(10px, env(safe-area-inset-bottom));
        left: max(10px, env(safe-area-inset-left));
        max-height: none;
        position: fixed;
        right: max(10px, env(safe-area-inset-right));
        top: max(10px, env(safe-area-inset-top));
        width: auto;
    }
    .ai-helper-panel header { padding: 13px 16px; }
    .ai-helper-panel header button { min-height: 44px; min-width: 44px; }
    .ai-helper-messages { min-height: 0; overscroll-behavior: contain; }
    .ai-helper-suggestions button { min-height: 42px; padding: 8px 12px; }
    .ai-helper-panel textarea { font-size: 16px; min-height: 82px; }
    .ai-helper-panel form button { min-height: 44px; min-width: 76px; }
}

@media (min-width: 681px) and (max-width: 900px) {
    .inspection-conduct-page:not(.ai-helper-open) .ai-helper {
        bottom: calc(92px + max(14px, env(safe-area-inset-bottom)));
        left: max(14px, env(safe-area-inset-left));
        right: auto;
    }
}
