/* Lucia is an overlay tool, never a layout row. Keep the closed footprint
   deliberately small so the operational work surface remains usable. */
body.app-shell[data-zestia-os-surface="light"] .content.app-shell-main {
  padding: 0;
}

body[data-zestia-os-surface="light"] .ops-assistant {
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  left: auto;
  /* Operational alerts, calls and confirmation dialogs must always win. */
  z-index: 2000;
  display: flex;
  width: auto;
  max-width: calc(100vw - 24px);
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
  isolation: isolate;
}

body[data-zestia-os-surface="light"] .ops-assistant__toggle {
  position: relative;
  display: inline-flex;
  width: auto;
  min-width: 118px;
  max-width: 164px;
  min-height: 52px;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  padding: 6px 12px 6px 6px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 999px;
  background: #0f172a;
  color: #ffffff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.22);
  pointer-events: auto;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

body[data-zestia-os-surface="light"] .ops-assistant__toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.26);
}

body[data-zestia-os-surface="light"] .ops-assistant__toggle:focus-visible,
body[data-zestia-os-surface="light"] .ops-assistant__panel button:focus-visible,
body[data-zestia-os-surface="light"] .ops-assistant__panel input:focus-visible,
body[data-zestia-os-surface="light"] .ops-assistant__panel summary:focus-visible {
  outline: 3px solid rgba(13, 148, 136, 0.34);
  outline-offset: 3px;
}

body[data-zestia-os-surface="light"] .ops-assistant__toggle span,
body[data-zestia-os-surface="light"] .ops-assistant.is-enabled .ops-assistant__toggle span {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
}

body[data-zestia-os-surface="light"] .ops-assistant__toggle-mark,
body[data-zestia-os-surface="light"] .ops-assistant.is-enabled .ops-assistant__toggle-mark {
  display: inline-flex;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 50%;
  background: linear-gradient(145deg, #14b8a6, #0f766e);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.26);
}

body[data-zestia-os-surface="light"] .ops-assistant__toggle-mark i {
  display: block;
  width: 3px;
  border-radius: 999px;
  background: #ffffff;
}

body[data-zestia-os-surface="light"] .ops-assistant__toggle-mark i:nth-child(1),
body[data-zestia-os-surface="light"] .ops-assistant__toggle-mark i:nth-child(4) {
  height: 10px;
}

body[data-zestia-os-surface="light"] .ops-assistant__toggle-mark i:nth-child(2) {
  height: 20px;
}

body[data-zestia-os-surface="light"] .ops-assistant__toggle-mark i:nth-child(3) {
  height: 15px;
}

body[data-zestia-os-surface="light"] .ops-assistant__toggle-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
  text-align: left;
}

body[data-zestia-os-surface="light"] .ops-assistant__toggle-copy strong,
body[data-zestia-os-surface="light"] .ops-assistant__toggle-copy small {
  overflow: hidden;
  color: #ffffff;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-zestia-os-surface="light"] .ops-assistant__toggle-copy strong {
  font-size: 13px;
  font-weight: 900;
  line-height: 1.15;
}

body[data-zestia-os-surface="light"] .ops-assistant__toggle-copy small {
  color: #a7f3d0;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
}

body[data-zestia-os-surface="light"] .ops-assistant:not(.is-enabled) .ops-assistant__toggle-copy small {
  color: #cbd5e1;
}

body[data-zestia-os-surface="light"] .ops-assistant__panel {
  order: -1;
  width: min(390px, calc(100vw - 24px));
  max-width: none;
  max-height: min(620px, calc(100dvh - 92px));
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid #d8e1ea;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.99);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.24);
  pointer-events: auto;
  scrollbar-gutter: stable;
  transform-origin: bottom right;
  animation: ops-assistant-panel-in 150ms ease-out;
}

body[data-zestia-os-surface="light"] .ops-assistant__panel[hidden] {
  display: none;
}

@keyframes ops-assistant-panel-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

body[data-zestia-os-surface="light"] .ops-assistant.is-listening .ops-assistant__toggle-mark i {
  animation: ops-assistant-wave 800ms ease-in-out infinite alternate;
}

body[data-zestia-os-surface="light"] .ops-assistant.is-listening .ops-assistant__toggle-mark i:nth-child(2) {
  animation-delay: 120ms;
}

body[data-zestia-os-surface="light"] .ops-assistant.is-listening .ops-assistant__toggle-mark i:nth-child(3) {
  animation-delay: 240ms;
}

body[data-zestia-os-surface="light"] .ops-assistant.is-listening .ops-assistant__toggle-mark i:nth-child(4) {
  animation-delay: 360ms;
}

@keyframes ops-assistant-wave {
  to { transform: scaleY(0.55); }
}

@media (max-width: 680px) {
  body[data-zestia-os-surface="light"] .ops-assistant {
    right: max(10px, env(safe-area-inset-right, 0px));
    bottom: max(10px, env(safe-area-inset-bottom, 0px));
    left: auto;
    width: auto;
    max-width: calc(100vw - 20px);
  }

  body[data-zestia-os-surface="light"] .ops-assistant__toggle {
    width: 52px;
    min-width: 52px;
    max-width: 52px;
    height: 52px;
    min-height: 52px;
    justify-content: center;
    padding: 6px;
  }

  body[data-zestia-os-surface="light"] .ops-assistant__toggle-copy {
    display: none;
  }

  body[data-zestia-os-surface="light"] .ops-assistant__panel {
    width: min(360px, calc(100vw - 20px));
    max-height: calc(100dvh - 82px);
    padding: 12px;
  }

  body[data-zestia-os-surface="light"] .ops-assistant__state {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  body[data-zestia-os-surface="light"] .ops-assistant__mic,
  body[data-zestia-os-surface="light"] .ops-assistant__switch {
    width: auto;
  }
}

@media (max-width: 380px) {
  body[data-zestia-os-surface="light"] .ops-assistant__panel {
    width: calc(100vw - 16px);
  }

  body[data-zestia-os-surface="light"] .ops-assistant__suggestions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-zestia-os-surface="light"] .ops-assistant__toggle,
  body[data-zestia-os-surface="light"] .ops-assistant__panel,
  body[data-zestia-os-surface="light"] .ops-assistant__toggle-mark i {
    animation: none;
    transition: none;
  }
}
