:host {
  --tizzle-launcher-bg: #ffffff;
  --tizzle-launcher-surface: #f4f4f4;
  --tizzle-launcher-hover: #eeeeee;
  --tizzle-launcher-text: #111111;
  --tizzle-launcher-muted: #6b6b6b;
  --tizzle-launcher-border: rgba(0, 0, 0, 0.12);
  --tizzle-launcher-focus: #111111;
  --tizzle-launcher-shadow: 0 18px 52px rgba(0, 0, 0, 0.16), 0 3px 12px rgba(0, 0, 0, 0.08);
  --tizzle-app-image-filter: none;
  --tizzle-logo-surface: #fdfdfd;
  --tizzle-svg-filter: none;
  --tizzle-t0-filter: invert(1);
  display: inline-block;
  position: relative;
  color-scheme: light dark;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.4;
  text-align: left;
  vertical-align: middle;
  z-index: 2147483000;
}

:host([theme="light"]) {
  color-scheme: light;
}

:host([theme="dark"]) {
  --tizzle-launcher-bg: #151515;
  --tizzle-launcher-surface: #222222;
  --tizzle-launcher-hover: #252525;
  --tizzle-launcher-text: #f5f5f5;
  --tizzle-launcher-muted: #a3a3a3;
  --tizzle-launcher-border: rgba(255, 255, 255, 0.14);
  --tizzle-launcher-focus: #ffffff;
  --tizzle-launcher-shadow: 0 18px 52px rgba(0, 0, 0, 0.5), 0 3px 12px rgba(0, 0, 0, 0.32);
  --tizzle-app-image-filter: invert(1);
  --tizzle-logo-surface: #000000;
  --tizzle-svg-filter: invert(1);
  --tizzle-t0-filter: none;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

button,
a {
  font: inherit;
}

.launcher-button {
  align-items: center;
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--tizzle-launcher-text);
  cursor: pointer;
  display: inline-flex;
  height: 40px;
  justify-content: center;
  margin: 0;
  padding: 0;
  transition: color 160ms ease, transform 140ms ease;
  width: 40px;
}

.launcher-button:hover {
  color: var(--tizzle-launcher-text);
}

.launcher-button:active {
  transform: scale(0.96);
}

.launcher-button:focus-visible,
.app-link:focus-visible,
.help-link:focus-visible,
.error button:focus-visible {
  outline: 2px solid var(--tizzle-launcher-focus);
  outline-offset: 2px;
}

.launcher-button svg {
  fill: currentColor;
  height: 20px;
  opacity: 0.82;
  transition: opacity 160ms ease;
  width: 20px;
}

.launcher-button svg circle {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 170ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.launcher-button:is(:hover, :focus-visible, [aria-expanded="true"]) svg {
  opacity: 1;
}

.launcher-button:is(:hover, :focus-visible, [aria-expanded="true"]) svg circle:nth-child(1) { transform: translate(-1.5px, -1.5px); }
.launcher-button:is(:hover, :focus-visible, [aria-expanded="true"]) svg circle:nth-child(2) { transform: translateY(-1.5px); }
.launcher-button:is(:hover, :focus-visible, [aria-expanded="true"]) svg circle:nth-child(3) { transform: translate(1.5px, -1.5px); }
.launcher-button:is(:hover, :focus-visible, [aria-expanded="true"]) svg circle:nth-child(4) { transform: translateX(-1.5px); }
.launcher-button:is(:hover, :focus-visible, [aria-expanded="true"]) svg circle:nth-child(6) { transform: translateX(1.5px); }
.launcher-button:is(:hover, :focus-visible, [aria-expanded="true"]) svg circle:nth-child(7) { transform: translate(-1.5px, 1.5px); }
.launcher-button:is(:hover, :focus-visible, [aria-expanded="true"]) svg circle:nth-child(8) { transform: translateY(1.5px); }
.launcher-button:is(:hover, :focus-visible, [aria-expanded="true"]) svg circle:nth-child(9) { transform: translate(1.5px, 1.5px); }

.panel {
  animation: panel-in 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
  background: var(--tizzle-launcher-bg);
  border: 0;
  border-radius: 22px;
  box-shadow: var(--tizzle-launcher-shadow);
  color: var(--tizzle-launcher-text);
  max-height: min(500px, calc(100vh - 80px));
  overflow: auto;
  padding: 12px;
  position: absolute;
  right: 0;
  scrollbar-color: var(--tizzle-launcher-border) transparent;
  scrollbar-width: thin;
  top: calc(100% + 8px);
  transform-origin: top right;
  width: 332px;
}

.panel-header {
  align-items: center;
  display: flex;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.01em;
  padding: 7px 9px 12px;
}

.app-grid {
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}

.app-link {
  align-items: center;
  border-radius: 13px;
  color: inherit;
  display: flex;
  flex-direction: column;
  min-height: 98px;
  padding: 9px 5px 8px;
  position: relative;
  text-decoration: none;
  transition: background-color 140ms ease;
}

.app-link:hover {
  background: var(--tizzle-launcher-hover);
}

.panel-footer {
  display: flex;
  justify-content: flex-end;
  padding: 8px 4px 0;
}

.help-link {
  align-items: center;
  border-radius: 999px;
  color: var(--tizzle-launcher-muted);
  display: inline-flex;
  height: 28px;
  justify-content: center;
  transition: background-color 140ms ease, color 140ms ease, transform 140ms ease;
  width: 28px;
}

.help-link:hover {
  background: var(--tizzle-launcher-hover);
  color: var(--tizzle-launcher-text);
}

.help-link:active {
  transform: scale(0.94);
}

.help-link svg {
  fill: none;
  height: 16px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
  width: 16px;
}

.help-link .help-dot {
  fill: currentColor;
  stroke: none;
}

.app-icon {
  align-items: center;
  background: var(--tizzle-launcher-surface);
  border: 1px solid var(--tizzle-launcher-border);
  border-radius: 14px;
  display: flex;
  height: 48px;
  justify-content: center;
  overflow: hidden;
  width: 48px;
}

.app-icon img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.app-icon img[src*="t0-logo-white.png"] {
  filter: var(--tizzle-t0-filter);
  object-fit: contain;
  padding: 4px;
}

.app-icon:not(.has-dark-image) img[src*="/apps/icons/"][src$="-logo.png"] {
  filter: var(--tizzle-app-image-filter);
}

.app-icon:not(.has-dark-image) img[src*="/apps/icons/"]:is(
  [src*="/apps/icons/crooli-ai-logo.png"],
  [src*="/apps/icons/calendar-logo.png"],
  [src*="/apps/icons/mail-logo.png"],
  [src*="/apps/icons/drive-logo.png"],
  [src*="/apps/icons/docs-logo.png"],
  [src*="/apps/icons/meet-logo.png"]
) {
  filter: none;
}

.app-icon img:is(
  [src*="/apps/icons/calendar-logo.png"],
  [src*="/apps/icons/mail-logo.png"],
  [src*="/apps/icons/drive-logo.png"],
  [src*="/apps/icons/docs-logo.png"],
  [src*="/apps/icons/meet-logo.png"]
) {
  height: 86%;
  object-fit: contain;
  width: 86%;
}

.app-icon.has-themed-surface {
  background: var(--tizzle-logo-surface);
}

.app-icon-dark {
  display: none !important;
}

:host([theme="dark"]) .app-icon.has-dark-image .app-icon-light {
  display: none;
}

:host([theme="dark"]) .app-icon.has-dark-image .app-icon-dark {
  display: block !important;
}

.app-icon img[src$=".svg"] {
  filter: var(--tizzle-svg-filter);
}

.app-icon img[src*="tizzlesearchlogo.svg"] {
  object-fit: contain;
  padding: 8px;
}

.icon-fallback {
  color: var(--tizzle-launcher-text);
  display: block;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.app-icon.has-image .icon-fallback {
  display: none;
}

.app-name {
  display: block;
  font-size: 12px;
  font-weight: 560;
  margin-top: 7px;
  max-width: 100%;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.loading,
.error,
.empty {
  align-items: center;
  color: var(--tizzle-launcher-muted);
  display: flex;
  font-size: 12px;
  justify-content: center;
  margin: 0;
  min-height: 120px;
  padding: 20px;
  text-align: center;
}

.loading {
  gap: 9px;
}

.loading-dot {
  animation: pulse 1.1s ease-in-out infinite;
  background: currentColor;
  border-radius: 50%;
  height: 6px;
  width: 6px;
}

.error {
  flex-direction: column;
  gap: 12px;
}

.error p {
  margin: 0;
}

.error button {
  appearance: none;
  background: var(--tizzle-launcher-text);
  border: 0;
  border-radius: 999px;
  color: var(--tizzle-launcher-bg);
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
  padding: 7px 12px;
}

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

@keyframes pulse {
  50% { opacity: 0.25; transform: scale(0.8); }
}

@media (max-width: 420px) {
  .panel {
    left: 12px;
    max-height: calc(100dvh - 84px);
    position: fixed;
    right: 12px;
    top: 64px;
    width: auto;
  }

  .app-link {
    min-height: 98px;
  }
}

@media (prefers-color-scheme: dark) {
  :host(:not([theme="light"]):not([theme="dark"])) {
    --tizzle-launcher-bg: #151515;
    --tizzle-launcher-surface: #222222;
    --tizzle-launcher-hover: #252525;
    --tizzle-launcher-text: #f5f5f5;
    --tizzle-launcher-muted: #a3a3a3;
    --tizzle-launcher-border: rgba(255, 255, 255, 0.14);
    --tizzle-launcher-focus: #ffffff;
    --tizzle-launcher-shadow: 0 18px 52px rgba(0, 0, 0, 0.5), 0 3px 12px rgba(0, 0, 0, 0.32);
    --tizzle-app-image-filter: invert(1);
    --tizzle-logo-surface: #000000;
    --tizzle-svg-filter: invert(1);
    --tizzle-t0-filter: none;
  }

  :host(:not([theme="light"]):not([theme="dark"])) .app-icon.has-dark-image .app-icon-light {
    display: none;
  }

  :host(:not([theme="light"]):not([theme="dark"])) .app-icon.has-dark-image .app-icon-dark {
    display: block !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel,
  .loading-dot {
    animation: none;
  }

  .launcher-button,
  .launcher-button svg,
  .launcher-button svg circle,
  .app-link,
  .help-link {
    transition: none;
  }
}
