@layer features {
.lumi-ai-shell { width: 100%; min-width: 0; }
.lumi-ai-overlay-root { position: fixed; inset: 0; z-index: 60; pointer-events: none; isolation: isolate; }
.lumi-ai-pill { width: 100%; min-height: 42px; display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2); color: var(--ink); cursor: pointer; }
.lumi-ai-pill:hover { border-color: var(--sea); background: var(--surface-3); }
.lumi-ai-mark { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; background: var(--sea); color: white; font-size: 10px; font-weight: 800; }
.lumi-ai-pill-label { flex: 1; text-align: left; font-weight: 700; }
.lumi-ai-state { width: 8px; height: 8px; border-radius: 50%; background: #8b949e; box-shadow: 0 0 0 3px color-mix(in srgb, #8b949e 18%, transparent); }
.lumi-ai-state.ready { background: #2ea043; box-shadow: 0 0 0 3px color-mix(in srgb, #2ea043 18%, transparent); }
.lumi-ai-state.warming { background: #d29922; box-shadow: 0 0 0 3px color-mix(in srgb, #d29922 18%, transparent); }
.lumi-ai-state.error { background: #d73a49; box-shadow: 0 0 0 3px color-mix(in srgb, #d73a49 18%, transparent); }
.lumi-ai-panel { position: fixed; z-index: 1; left: calc(var(--sidebar-width, 260px) + 14px); right: 14px; bottom: 14px; height: max(180px, 16.666vh); min-height: 180px; max-height: calc(100vh - 96px); display: grid; grid-template-rows: 8px auto 1fr auto auto; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: var(--card); box-shadow: 0 18px 55px rgba(0,0,0,.22); opacity: 0; transform: translateY(100%); pointer-events: none; transition: transform 0.25s ease-in-out, opacity 0.25s ease-in-out; }
.lumi-ai-panel.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.lumi-ai-resize-handle { position: relative; cursor: ns-resize; background: var(--surface-2); touch-action: none; }
.lumi-ai-resize-handle::after { content: ""; position: absolute; top: 3px; left: 50%; width: 42px; height: 2px; transform: translateX(-50%); border-radius: 2px; background: var(--border); }
.lumi-ai-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.lumi-ai-header div { display: flex; align-items: baseline; gap: 10px; }
.lumi-ai-header span { color: var(--ink-soft); font-size: 12px; }
.lumi-ai-header-actions { align-items: center !important; }
.lumi-ai-clear { border: 0; background: transparent; color: var(--ink-soft); cursor: pointer; font-size: 12px; font-weight: 700; }
.lumi-ai-close { border: 0; background: transparent; color: var(--ink-soft); font-size: 22px; cursor: pointer; }
.lumi-ai-messages { min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.lumi-ai-message { max-width: min(860px, 90%); padding: 8px 10px; border-radius: 7px; overflow-wrap: anywhere; line-height: 1.45; }
.lumi-ai-message.assistant { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); }
.lumi-ai-message h1, .lumi-ai-message h2, .lumi-ai-message h3 { margin: 4px 0 8px; font-size: 1.05rem; }
.lumi-ai-message p { margin: 0 0 8px; }
.lumi-ai-message p:last-child { margin-bottom: 0; }
.lumi-ai-message ul, .lumi-ai-message ol { margin: 6px 0; padding-left: 22px; }
.lumi-ai-message blockquote { margin: 7px 0; padding-left: 10px; border-left: 3px solid var(--border); color: var(--ink-soft); }
.lumi-ai-message a { color: var(--sea); font-weight: 700; text-decoration: underline; }
.lumi-ai-message code { padding: 1px 4px; border-radius: 4px; background: color-mix(in srgb, var(--ink) 8%, transparent); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .92em; }
.lumi-ai-code { position: relative; margin: 8px 0; overflow: hidden; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-3); }
.lumi-ai-code-header { display: flex; align-items: center; justify-content: space-between; min-height: 30px; padding: 4px 7px 4px 10px; border-bottom: 1px solid var(--border); color: var(--ink-soft); font-size: 11px; text-transform: lowercase; }
.lumi-ai-code-copy { padding: 4px 7px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-2); color: var(--ink); cursor: pointer; font-size: 11px; }
.lumi-ai-code pre { margin: 0; padding: 11px; overflow: auto; }
.lumi-ai-code pre code { display: block; padding: 0; background: transparent; white-space: pre; overflow-wrap: normal; }
.lumi-ai-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.lumi-ai-links a { color: var(--sea); font-weight: 700; text-decoration: underline; }
.lumi-ai-message.user { align-self: flex-end; background: var(--sea); color: white; }
.lumi-ai-message.error { border-color: var(--rose); color: var(--rose); }
.lumi-ai-message.pending { display: flex; align-items: center; gap: 9px; color: var(--ink-soft); }
.lumi-ai-pending-progress { min-width: 0; }
.lumi-ai-timeout-controls { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.lumi-ai-timeout-controls[hidden] { display: none; }
.lumi-ai-timeout-controls button { padding: 5px 8px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface-2); color: var(--ink); cursor: pointer; font-weight: 700; }
.lumi-ai-timeout-controls button:disabled { opacity: .55; cursor: wait; }
.lumi-ai-timeout-details { margin-top: 7px; color: var(--ink-soft); font-size: 11px; line-height: 1.45; }
.lumi-ai-timeout-details[hidden] { display: none; }
.lumi-ai-spinner { width: 14px; height: 14px; flex: 0 0 auto; border: 2px solid color-mix(in srgb, var(--sea) 25%, transparent); border-top-color: var(--sea); border-radius: 50%; animation: lumi-ai-spin .8s linear infinite; }
.lumi-ai-retry { margin-top: 8px; padding: 5px 9px; border: 1px solid var(--rose); border-radius: 5px; background: transparent; color: inherit; cursor: pointer; font-weight: 700; }
.lumi-ai-retry:disabled { opacity: .65; cursor: wait; }
.lumi-ai-confirm { display: flex; gap: 8px; margin-top: 8px; }
.lumi-ai-confirm button { padding: 5px 9px; border-radius: 5px; border: 1px solid var(--border); cursor: pointer; }
.lumi-ai-feedback { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--border); color: var(--ink-soft); font-size: 11px; }
.lumi-ai-feedback-quick-actions, .lumi-ai-feedback-details { display: flex; flex: 1 1 100%; flex-wrap: wrap; gap: 6px; }
.lumi-ai-feedback-details[hidden] { display: none; }
.lumi-ai-feedback select, .lumi-ai-feedback input, .lumi-ai-feedback button { min-height: 29px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface-2); color: var(--ink); padding: 4px 7px; font: inherit; }
.lumi-ai-feedback input { flex: 1 1 180px; }
.lumi-ai-feedback button { cursor: pointer; font-weight: 700; }
.lumi-ai-feedback button:disabled { opacity: .6; cursor: wait; }
.lumi-ai-compose { display: grid; grid-template-columns: 1fr 40px; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); }
.lumi-ai-cooldown { grid-column: 1 / -1; color: var(--rose); font-size: 12px; font-weight: 700; }
.lumi-ai-compose textarea { width: 100%; min-height: 40px; max-height: 96px; resize: vertical; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); color: var(--ink); padding: 8px; }
.lumi-ai-compose button { display: grid; place-items: center; border: 0; border-radius: 6px; background: var(--sea); color: white; cursor: pointer; }
.lumi-ai-compose button:disabled { opacity: .55; cursor: wait; }
.lumi-ai-compose svg { width: 19px; height: 19px; }
.lumi-ai-disclaimer { position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 28px; padding: 4px 12px 7px; color: var(--ink-soft); font-size: 11px; }
.lumi-ai-disclaimer details { position: relative; }
.lumi-ai-disclaimer summary { display: grid; place-items: center; width: 16px; height: 16px; border: 1px solid var(--border); border-radius: 50%; cursor: pointer; color: var(--ink); font-size: 10px; font-weight: 800; list-style: none; }
.lumi-ai-disclaimer summary::-webkit-details-marker { display: none; }
.lumi-ai-disclaimer-detail { position: absolute; right: 0; bottom: 24px; width: min(360px, calc(100vw - 32px)); padding: 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2); box-shadow: 0 10px 30px rgba(0,0,0,.2); color: var(--ink); font-size: 12px; line-height: 1.4; }
.lumi-ai-disclaimer details:not([open]) .lumi-ai-disclaimer-detail { display: none; }
.lumi-ai-disclaimer details:hover .lumi-ai-disclaimer-detail { display: block; }
.modal-backdrop.is-open { z-index: 200; }
@keyframes lumi-ai-spin { to { transform: rotate(360deg); } }
@media (max-width: 800px) { .lumi-ai-panel { left: 10px; right: 10px; } }
body.sidebar-collapsed .lumi-ai-pill { justify-content: center; padding: 8px; }
body.sidebar-collapsed .lumi-ai-pill-label,
body.sidebar-collapsed .lumi-ai-state { display: none; }

.lumi-ai-header span,
.lumi-ai-clear,
.lumi-ai-code-header,
.lumi-ai-code-copy,
.lumi-ai-timeout-details,
.lumi-ai-feedback,
.lumi-ai-cooldown,
.lumi-ai-disclaimer,
.lumi-ai-disclaimer-detail { font-size: var(--lumi-font-size-sm); }
}
