/* Luna is a system widget: permanently anchored to the shell, never a dashboard tile. */
.lm-luna-root{display:flex;align-items:center}
.lm-luna-top-trigger{display:flex;align-items:center;gap:10px;height:42px;padding:0 15px;border:1px solid var(--lm-border);border-radius:13px;color:var(--lm-text);background:var(--lm-card);cursor:pointer;font-weight:700}
.lm-luna-top-trigger:hover{border-color:#9381ce}
.lm-luna-symbol{display:grid;place-items:center;width:29px;height:29px;border-radius:10px;background:linear-gradient(145deg,#8b75d8,#5649a3);color:#fff;font-size:16px}
.lm-luna-mini-wave{display:flex;align-items:center;gap:3px;height:17px;margin-left:5px}
.lm-luna-mini-wave b{width:3px;height:8px;border-radius:8px;background:#9784df}.lm-luna-mini-wave b:nth-child(2){height:15px}.lm-luna-mini-wave b:nth-child(3){height:11px}
.lm-luna-mobile-bar{display:none}
.lm-luna-overlay{position:fixed;inset:0;z-index:1100;background:rgba(10,13,25,.24)}
.lm-luna-panel{position:fixed;z-index:1101;right:24px;top:92px;width:min(400px,calc(100vw - 32px));max-height:calc(100dvh - 110px);display:flex;flex-direction:column;overflow:hidden;color:var(--lm-text);background:var(--lm-card);border:1px solid var(--lm-border);border-radius:22px;box-shadow:0 20px 70px rgba(0,0,0,.22)}
.lm-luna-panel-head{display:flex;align-items:center;gap:12px;padding:19px 20px 15px;border-bottom:1px solid var(--lm-border)}
.lm-luna-panel-icon{display:grid;place-items:center;width:43px;height:43px;border-radius:15px;background:linear-gradient(135deg,#9583e7,#50469e);color:#fff;font-size:22px}
.lm-luna-panel-heading{display:flex;flex-direction:column;flex:1;min-width:0}.lm-luna-panel-heading strong{font-size:20px}.lm-luna-panel-heading small{font-size:11px;color:var(--lm-muted)}
.lm-luna-head-close{border:0;background:transparent;color:var(--lm-muted);font-size:18px;cursor:pointer;padding:8px}
.lm-luna-tabs{display:flex;gap:4px;padding:8px 16px;border-bottom:1px solid var(--lm-border)}.lm-luna-tabs button{flex:1;padding:10px 4px;border:0;background:none;color:var(--lm-muted);border-radius:10px;cursor:pointer;font-size:13px;font-weight:600}.lm-luna-tabs button.active{background:rgba(139,117,216,.15);color:#9784df}
.lm-luna-body{padding:18px;overflow:auto;min-height:0}.lm-luna-conversation{display:flex;flex-direction:column;min-height:300px;gap:10px}
.lm-luna-welcome{text-align:center;margin:auto 4px;padding:12px 5px}.lm-luna-welcome strong{display:block;margin:14px 0 6px;font-size:21px}.lm-luna-welcome p{margin:0;color:var(--lm-muted);font-size:13px;line-height:1.6}
.lm-luna-glow{margin:auto;display:grid;place-items:center;width:75px;height:75px;border-radius:50%;background:radial-gradient(circle,#a18ae6,#554795);box-shadow:0 0 35px #917de84a;color:#fff;font-size:34px}
.lm-luna-composer{display:flex;gap:8px;align-items:center;border:1px solid var(--lm-border);padding:6px;border-radius:15px;background:var(--lm-bg,var(--lm-card))}.lm-luna-composer input{flex:1;min-width:0;outline:none;border:0;color:var(--lm-text);background:transparent;font-size:13px}
.lm-luna-mic,.lm-luna-send{border:0;display:grid;place-items:center;width:37px;height:37px;flex:0 0 37px;border-radius:11px;cursor:pointer}.lm-luna-mic{background:rgba(139,117,216,.15);color:#9c84e5}.lm-luna-mic.active{color:#fff;background:#d34c68;animation:lm-luna-pulse 1.4s infinite}.lm-luna-send{background:#7863cb;color:white}.lm-luna-send:disabled{opacity:.4}
@keyframes lm-luna-pulse{50%{box-shadow:0 0 0 7px #d34c681e}}
.lm-luna-user-message{max-width:90%;align-self:flex-end;background:#7664bc;color:#fff;border-radius:15px 15px 3px 15px;padding:10px 12px;font-size:13px;word-break:break-word}.lm-luna-hint{font-size:12px;color:var(--lm-muted);background:rgba(139,117,216,.10);border-radius:12px;padding:11px 12px;margin:2px 0}
.lm-luna-footnote{display:block;color:var(--lm-muted);font-size:11px;line-height:1.5;text-align:center}
.lm-luna-settings{display:flex;flex-direction:column;gap:16px}.lm-luna-settings label{font-size:13px;font-weight:600;display:block}.lm-luna-settings label output{float:right;color:#a18ae6}.lm-luna-settings label small{font-size:11px;color:var(--lm-muted);display:block;font-weight:400;margin-top:4px}.lm-luna-settings select{width:100%;display:block;color:var(--lm-text);background:var(--lm-card);border:1px solid var(--lm-border);border-radius:10px;padding:9px;margin-top:7px}.lm-luna-settings input[type=range]{width:100%;display:block;accent-color:#8e78d6;margin-top:9px}
.lm-luna-service{display:flex;align-items:center;gap:8px;background:rgba(139,117,216,.08);padding:11px;border-radius:12px;font-size:12px}.lm-luna-service strong{margin-left:auto;font-size:11px}.lm-luna-service button{border:0;background:none;color:var(--lm-muted);cursor:pointer}.lm-luna-dot-online,.lm-luna-dot-offline{height:9px;width:9px;border-radius:50%;background:#22ae73}.lm-luna-dot-offline{background:#c86f6f}
.lm-luna-settings .lm-luna-switch{display:flex;align-items:center;justify-content:space-between}.lm-luna-switch input{accent-color:#8e78d6;width:18px;height:18px}.lm-luna-actions{display:flex;gap:9px}.lm-luna-test{flex:1;background:linear-gradient(120deg,#806bc9,#5e50a9);color:#fff;border:0;border-radius:11px;padding:11px;font-size:13px;font-weight:600;cursor:pointer}.lm-luna-test:disabled{opacity:.45;cursor:default}.lm-luna-stop{padding:0 16px;color:var(--lm-text);background:transparent;border:1px solid var(--lm-border);border-radius:11px}
@media(max-width:700px){
  .lm-luna-root{display:contents}
  .lm-luna-top-trigger{display:none}
  .lm-luna-mobile-bar{display:flex;align-items:center;justify-content:center;width:100%;padding:4px 0 11px;margin:0 0 8px;border-bottom:1px solid var(--lm-border);background:transparent}
  .lm-luna-mobile-trigger{display:flex;align-items:center;justify-content:center;width:48px;height:48px;background:linear-gradient(105deg,#8e78d8,#594baf);border:0;border-radius:13px;color:#fff;cursor:pointer;box-shadow:0 5px 14px #7662be40}
  .lm-luna-mobile-trigger .lm-luna-symbol{background:#ffffff22}
  .lm-luna-overlay{background:rgba(7,9,17,.42)}
  .lm-luna-panel{left:8px;right:8px;top:auto;bottom:calc(12px + env(safe-area-inset-bottom,0px));width:auto;max-height:calc(100dvh - 32px - env(safe-area-inset-bottom,0px));border-radius:19px}
  .lm-luna-panel-head{padding:14px 16px 12px}.lm-luna-body{padding:14px}.lm-luna-conversation{min-height:245px}
}
@media(prefers-reduced-motion:reduce){.lm-luna-mic.active{animation:none}}

/* Luna voice mode: no chat, forms or settings in the conversation surface. */
.lm-luna-voice-overlay{position:fixed;inset:0;z-index:1200;display:grid;place-items:center;padding:24px;background:rgba(9,11,21,.76);backdrop-filter:blur(15px);-webkit-backdrop-filter:blur(15px)}
.lm-luna-voice-stage{position:relative;width:min(420px,100%);display:flex;flex-direction:column;align-items:center;text-align:center;color:#f4f0ff;padding:44px 24px 34px}
.lm-luna-voice-close{position:absolute;top:0;right:0;width:44px;height:44px;border:0;background:#ffffff16;border-radius:50%;color:#fff;cursor:pointer;font-size:17px}
.lm-luna-orb-shell{position:relative;width:215px;height:215px;display:grid;place-items:center;margin:14px 0 24px;isolation:isolate}
.lm-luna-orb-ring{position:absolute;inset:10px;border-radius:50%;border:1px solid #ab9bff55;box-shadow:0 0 45px #8973e834;animation:lm-luna-breathe 3s ease-in-out infinite;pointer-events:none}
.lm-luna-ring-two{inset:-2px;animation-delay:-1.5s;opacity:.7}
.lm-luna-orb{width:152px;height:152px;border:1px solid #c4adff70;border-radius:50%;color:white;background:radial-gradient(circle at 32% 28%,#b49ff0,#7b65d5 43%,#3e337d 83%);box-shadow:0 0 38px #9680f58a,0 0 95px #725bd54d,inset -13px -16px 32px #29215d70;cursor:pointer;font-size:65px;transition:transform .2s;z-index:1}
.lm-luna-orb:hover{transform:scale(1.035)}.lm-luna-orb:disabled{cursor:wait}
.lm-luna-listening .lm-luna-orb{background:radial-gradient(circle at 32% 28%,#dec2f9,#ae6ed0 48%,#603579 90%)}
.lm-luna-listening .lm-luna-orb-ring{border-color:#e2a1ff;animation-duration:1.2s}
.lm-luna-speaking .lm-luna-orb-ring{animation-duration:1.7s}
.lm-luna-voice-name{font-size:28px;letter-spacing:.3px}.lm-luna-greeting{font-size:17px;line-height:1.5;margin:12px 0 8px;min-height:50px}
.lm-luna-voice-tip{color:#c4bbdd;font-size:12px;margin:10px 0}
.lm-luna-voice-notice{font-size:13px;color:#eee7ff;background:#ffffff13;padding:10px 15px;border-radius:12px;overflow-wrap:anywhere;max-width:100%}
.lm-luna-voice-wave{height:26px;display:flex;align-items:center;gap:5px;margin-top:8px}.lm-luna-voice-wave b{width:4px;height:10px;border-radius:4px;background:#bba5ff;animation:lm-luna-bars .8s ease-in-out infinite alternate}.lm-luna-voice-wave b:nth-child(even){animation-delay:-.35s}.lm-luna-voice-wave b:nth-child(3n){animation-delay:-.65s}
.lm-luna-voice-stop{margin-top:14px;border:1px solid #ffffff40;background:#ffffff14;border-radius:12px;color:#fff;padding:9px 16px;cursor:pointer}
@keyframes lm-luna-breathe{50%{transform:scale(1.13);opacity:.35}}@keyframes lm-luna-bars{to{height:25px}}
@media(max-width:700px){.lm-luna-voice-overlay{padding:20px 12px calc(82px + env(safe-area-inset-bottom,0px))}.lm-luna-voice-stage{padding:28px 16px}.lm-luna-orb-shell{width:195px;height:195px}.lm-luna-orb{width:142px;height:142px}}
@media(prefers-reduced-motion:reduce){.lm-luna-orb-ring,.lm-luna-voice-wave b{animation:none}}

/* v1.7.19: The Luna mobile control belongs to the fixed sidebar footer, directly
   above Widgets; it never creates a viewport-wide navigation dock. */
.lm-luna-sidebar-slot{display:none}
@media (max-width:820px){
  .lm-sidebar{display:flex;}
  .lm-luna-sidebar-slot{display:block;width:48px;flex:0 0 auto;}
  .lm-sidebar-bottom{padding-bottom:env(safe-area-inset-bottom,0px);}
  .lm-luna-mobile-bar{display:flex;align-items:center;justify-content:center;width:48px;margin:0 0 10px;padding:0 0 10px;border-bottom:1px solid var(--lm-border);}
  .lm-luna-mobile-trigger{min-width:0;width:48px;height:48px;border-radius:13px;}
  .lm-luna-mobile-trigger>span:last-child{display:none;}
  .lm-luna-mobile-trigger .lm-luna-symbol{width:31px;height:31px;background:transparent;}
  .lm-luna-top-trigger{display:none;}
}
@media (min-width:701px) and (max-width:820px){
  .lm-luna-root{display:contents;}
}

/* The sidebar owns the Luna control; no teleport or floating bottom dock. */
@media (max-width:820px) {
  .lm-luna-sidebar-slot { width:48px; display:flex; flex:0 0 auto; justify-content:center; margin-bottom:9px; padding-bottom:11px; border-bottom:1px solid var(--lm-border); }
  .lm-luna-sidebar-slot .lm-luna-mobile-trigger { display:grid;place-items:center;width:48px;height:48px; min-height:48px; border-radius:13px; border:0; color:white; background:linear-gradient(135deg,#8e78d8,#594baf); cursor:pointer; box-shadow:0 5px 14px #7662be40; font-size:23px; }
  .lm-sidebar-bottom { flex-shrink:0; }
}

/* The modal portal lives outside #app so its theme variables must be mirrored. */
#lm-luna-portal.theme-dark {
    --lm-bg:#0b1422; --lm-sidebar:#101a2a; --lm-card:#111c2c;
    --lm-text:#c8d3e2; --lm-muted:#8593aa; --lm-border:#263349;
}

/* v1.7.43 — removed the temporary on-screen voice diagnostics panel. */
@media(max-width:700px){.lm-luna-voice-stage{max-height:calc(100dvh - 95px);overflow-y:auto;overscroll-behavior:contain}}

/* v1.7.42 — iOS user-gesture Web Audio playback recovery. */
.lm-luna-voice-replay{margin:8px 0 14px;padding:12px 20px;border:1px solid #d0b8ff99;border-radius:13px;background:#6e55bd;color:#fff;font-size:14px;font-weight:600;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:10px;min-height:44px;touch-action:manipulation}
.lm-luna-voice-replay:active{transform:scale(.98)}
