:root { font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; color: #091d4b; }
* { box-sizing: border-box; }
button { font: inherit; }
.map-page { margin: 0; }
.app-shell { position: relative; height: 100vh; height: 100dvh; overflow: hidden; background: #dde9e3; }
.map-page #map { position: absolute; inset: 0; height: 100%; }
#chat-status:empty { display: none; }
#chat-status { position: absolute; z-index: 550; bottom: 104px; left: 24px; max-width: 380px; margin: 0; padding: 12px 16px; border-radius: 14px; background: #fff; box-shadow: 0 5px 20px #0b315d20; color: #45608c; font-size: 12px; line-height: 1.4; }
.map-hint { position: absolute; z-index: 450; bottom: 106px; left: 50%; transform: translateX(-50%); padding: 10px 16px; border-radius: 999px; background: #ffffffeb; box-shadow: 0 5px 20px #0b315d20; color: #33476b; font-size: 12px; white-space: nowrap; pointer-events: none; }
.map-page .leaflet-top.leaflet-left { margin-top: 12px; }
.map-page .leaflet-control-zoom { border: 0; border-radius: 12px; overflow: hidden; box-shadow: 0 5px 20px #0b315d31; }
.map-page .leaflet-control-zoom a { width: 42px; height: 42px; line-height: 42px; color: #0a3d9b; }
.assistant-panel[hidden] { display: none; }
.assistant-panel { position: fixed; z-index: 1100; right: 24px; bottom: 104px; display: flex; flex-direction: column; width: min(390px, calc(100vw - 32px)); height: min(520px, calc(100dvh - 128px)); border: 1px solid #e1e8f4; border-radius: 22px; background: white; box-shadow: 0 20px 65px #091b4980; overflow: hidden; }
.assistant-header { display: flex; align-items: center; justify-content: space-between; padding: 16px; background: #082c79; color: white; }
.assistant-header > div { display: flex; align-items: center; gap: 10px; }
.assistant-spark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: #ffffff30; }
.assistant-header h2 { margin: 0; font-size: 15px; }
.assistant-header p { margin: 3px 0 0; color: #c8dafa; font-size: 11px; }
.assistant-header button { border: 0; background: none; color: white; font-size: 27px; cursor: pointer; }
.assistant-history { display: flex; flex: 1; flex-direction: column; gap: 10px; overflow: auto; padding: 18px; background: #f5f7fc; }
.assistant-message { max-width: 90%; align-self: flex-start; padding: 11px 14px; border-radius: 14px 14px 14px 3px; background: #fff; color: #172b59; font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 2px 10px #10265a0b; }
.assistant-message.from-user { align-self: flex-end; border-radius: 14px 14px 3px 14px; background: #0b53d5; color: #fff; }
.assistant-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid #e5ebf5; }
.assistant-form input { flex: 1; min-width: 0; padding: 11px 13px; border: 1px solid #ccd8ea; border-radius: 11px; font: inherit; font-size: 13px; }
.assistant-form button { padding: 0 16px; border: 0; border-radius: 11px; background: #0b53d5; color: #fff; font-weight: 700; cursor: pointer; }
.assistant-form button:disabled { opacity: .55; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
:is(.app-shell,.assistant-panel) :focus-visible { outline: 3px solid #ffbd36; outline-offset: 3px; }
@media (max-width: 640px) {
    #chat-status { top: calc(12px + env(safe-area-inset-top)); bottom: auto; left: 12px; right: 12px; max-width: none; }
    .map-hint { display: none; }
    .map-page .leaflet-top.leaflet-left { margin-top: calc(12px + env(safe-area-inset-top)); }
    .assistant-panel { left: 8px; right: 8px; bottom: calc(70px + env(safe-area-inset-bottom)); width: auto; height: min(480px, calc(100dvh - 162px - env(safe-area-inset-bottom))); }
    .assistant-header button { min-width: 44px; min-height: 44px; }
    .assistant-form input { font-size: 16px; }
    .assistant-form button { min-height: 44px; }
}

/* Markdown styling is scoped to formatted assistant replies. */
.assistant-message.from-assistant.is-markdown { white-space: normal; }
.assistant-message.is-markdown > :first-child { margin-top: 0; }
.assistant-message.is-markdown > :last-child { margin-bottom: 0; }
.assistant-message.is-markdown p { margin: 0 0 8px; }
.assistant-message.is-markdown ul,
.assistant-message.is-markdown ol { margin: 4px 0 8px; padding-left: 20px; }
.assistant-message.is-markdown li + li { margin-top: 4px; }
.assistant-message.is-markdown :is(h1,h2,h3,h4,h5,h6) { margin: 12px 0 6px; font-size: 1.1em; line-height: 1.3; }
.assistant-message.is-markdown blockquote { margin: 8px 0; padding-left: 12px; border-left: 3px solid currentColor; }
.assistant-message.is-markdown pre { max-width: 100%; overflow-x: auto; white-space: pre; padding: 8px; border-radius: 8px; background: #10265a0b; }
.assistant-message.is-markdown code { font-size: .9em; }
.assistant-message.is-markdown a { color: inherit; text-decoration: underline; }
.assistant-message.is-markdown table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.assistant-message.is-markdown :is(th,td) { padding: 5px 8px; border: 1px solid #ccd8ea; }
