/* Ask Noor: chat launcher and panel. Uses the page's colour tokens so it follows light and dark mode. */
:root { --noor-metal: #B9811C; --noor-glass: #FFF4D6; --noor-glow: #FFD36B; --noor-ink: #12332A; --noor-err: #B3261E; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --noor-metal: #E3A83C; --noor-glass: #3A2F17; --noor-glow: #FFCF5A; --noor-ink: #1B1305; --noor-err: #FF9C8F; } }
:root[data-theme="dark"] { --noor-metal: #E3A83C; --noor-glass: #3A2F17; --noor-glow: #FFCF5A; --noor-ink: #1B1305; --noor-err: #FF9C8F; }

.noor-launch { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 50; display: inline-flex; align-items: center; gap: 8px; min-height: 52px; padding: 5px 18px 5px 5px; border-radius: 999px; border: 2px solid var(--sun); background: var(--band); color: var(--on-band); font: 700 15px var(--font-body); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); cursor: pointer; }
.noor-launch .noor-svg { width: 40px; height: 40px; background: var(--bg); border-radius: 50%; padding: 3px; flex: none; }
.noor-launch:hover { transform: translateY(-1px); }
.noor-panel { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 60; width: min(420px, calc(100vw - 32px)); height: min(640px, calc(100vh - 32px)); display: grid; grid-template-rows: auto 1fr auto auto; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); overflow: hidden; font-family: var(--font-body); }
.noor-panel[hidden], .noor-launch[hidden], [data-noor-open][hidden], .noor-card[hidden], .noor-ask[hidden] { display: none; }
.noor-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--band); color: var(--on-band); }
.noor-head .noor-svg { width: 44px; height: 44px; background: var(--bg); border-radius: 50%; padding: 3px; flex: none; }
.noor-head > div { flex: 1; min-width: 0; line-height: 1.25; }
.noor-head b { font: 800 18px/1.1 var(--font-display); display: block; }
.noor-head span { font-size: 12.5px; opacity: 0.85; }
.noor-x { margin-left: auto; width: 40px; height: 40px; border-radius: 999px; border: 1px solid rgba(255, 246, 229, 0.35); background: none; color: inherit; font-size: 22px; line-height: 1; flex: none; cursor: pointer; }
.noor-log { overflow-y: auto; padding: 14px; display: grid; gap: 10px; align-content: start; background: var(--bg); }
.noor-msg { max-width: 92%; padding: 10px 12px; border-radius: 14px; font-size: 15px; line-height: 1.5; min-width: 0; overflow-wrap: anywhere; }
.noor-msg p { margin: 0 0 6px; }
.noor-msg p:last-child { margin-bottom: 0; }
.noor-msg ul { margin: 4px 0 6px; padding-left: 18px; display: grid; gap: 4px; }
.noor-bot { background: var(--surface); border: 1px solid var(--line); justify-self: start; border-bottom-left-radius: 4px; }
.noor-me { background: var(--band); color: var(--on-band); justify-self: end; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.noor-msg a.cite { display: inline-block; min-width: 19px; padding: 0 4px; text-align: center; font-size: 11px; font-weight: 700; line-height: 19px; border-radius: 10px; background: var(--sun-soft); color: var(--ink); text-decoration: none; margin: 0 1px; vertical-align: 2px; }
.noor-msg a.cite:hover { background: var(--sun); color: var(--on-sun); }
.noor-src { margin-top: 6px; font-size: 13px; }
.noor-src summary { cursor: pointer; color: var(--muted); }
.noor-src ol { margin: 6px 0 0; padding-left: 22px; display: grid; gap: 4px; }
.noor-cta { margin-top: 10px; }
.noor-cta .btn { min-height: 44px; padding: 8px 16px; font-size: 15px; }
.noor-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.noor-chip { border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px; padding: 7px 12px; min-height: 36px; font: 500 13.5px var(--font-body); text-align: left; cursor: pointer; }
.noor-chip:hover { border-color: var(--green-soft); }
.noor-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface); }
.noor-form textarea { flex: 1; min-width: 0; resize: none; overflow-y: auto; line-height: 1.35; font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); max-height: 120px; }
.noor-send { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--band); color: var(--on-band); display: grid; place-items: center; flex: none; cursor: pointer; }
.noor-send svg { width: 18px; height: 18px; }
.noor-form.busy .noor-send { opacity: 0.4; pointer-events: none; }
.noor-foot { margin: 0; padding: 0 14px 10px; font-size: 11.5px; line-height: 1.4; color: var(--muted); background: var(--surface); }
.noor-err { color: var(--noor-err); font-weight: 600; }
.noor-typing { display: flex; gap: 4px; }
.noor-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: noorblink 1.2s infinite both; }
.noor-typing i:nth-child(2) { animation-delay: 0.2s; }
.noor-typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes noorblink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.noor-ask { margin-top: 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
@media (max-width: 560px) {
  .noor-panel { inset: 0; width: auto; height: auto; max-width: 100%; border-radius: 0; border: 0; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .noor-head span { display: none; }
  body.noor-open { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) { .noor-typing i { animation: none; opacity: 0.6; } .noor-launch:hover { transform: none; } }
