:root {
  --dw-titlebar-height: 44px;
  --dw-carbon: #081720;
  --dw-carbon-soft: #102b36;
  --dw-cyan: #4fc5e8;
  --dw-gold: #e2aa48;
  --dw-title-ink: #f6fbfd;
}

body.dw-window {
  display: grid;
  grid-template-rows: var(--dw-titlebar-height) minmax(0, 1fr);
  color: #102934;
  background: var(--dw-carbon);
}

body.dw-window > #app,
body.dw-window > .call-shell {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.dw-titlebar {
  position: relative;
  z-index: 1000;
  min-width: 0;
  height: var(--dw-titlebar-height);
  display: grid;
  grid-template-columns: minmax(226px, auto) minmax(80px, 1fr) auto;
  align-items: stretch;
  overflow: visible;
  color: var(--dw-title-ink);
  background: var(--dw-carbon);
  border-bottom: 1px solid rgba(79, 197, 232, 0.3);
  user-select: none;
}

.dw-titlebar::after {
  position: absolute;
  right: 132px;
  bottom: -1px;
  width: 86px;
  height: 1px;
  background: var(--dw-cyan);
  box-shadow: 0 0 10px rgba(79, 197, 232, 0.75);
  content: "";
  pointer-events: none;
}

.dw-product-handle,
.dw-window-controls,
.dw-app-menu,
.dw-about {
  -webkit-app-region: no-drag;
}

.dw-product-handle {
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 18px;
  gap: 8px;
  align-items: center;
  padding: 0 10px 0 8px;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.dw-product-handle:hover,
.dw-product-handle[aria-expanded="true"] {
  background: var(--dw-carbon-soft);
}

.dw-product-handle > img {
  width: 36px;
  height: 30px;
  object-fit: contain;
}

.dw-product-copy,
.dw-product-copy strong,
.dw-product-copy small {
  min-width: 0;
  display: block;
  overflow: hidden;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dw-product-copy strong {
  font-size: 12px;
  font-weight: 700;
}

.dw-product-copy small {
  margin-top: 1px;
  color: rgba(226, 239, 244, 0.62);
  font-size: 9px;
  text-transform: uppercase;
}

.dw-product-handle > ion-icon {
  width: 15px;
  height: 15px;
  color: rgba(225, 240, 246, 0.64);
}

.dw-drag-zone {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  color: rgba(231, 243, 247, 0.68);
  font-size: 11px;
  -webkit-app-region: drag;
}

.dw-drag-zone span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dw-drag-beacon {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: var(--dw-gold);
  box-shadow: 0 0 0 3px rgba(226, 170, 72, 0.12);
  animation: dw-beacon 2.4s ease-in-out infinite;
}

.dw-window-controls {
  height: 100%;
  display: flex;
  align-items: flex-start;
  padding-right: 4px;
  opacity: 0.8;
  transform: translateY(-7px);
  transition: opacity 160ms ease, transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.dw-titlebar:hover .dw-window-controls,
.dw-window-controls:focus-within,
.dw-menu-open .dw-window-controls,
.dw-window-maximized .dw-window-controls {
  opacity: 1;
  transform: translateY(0);
}

.dw-window-controls button {
  width: 42px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 0 0 6px 6px;
  color: rgba(239, 248, 251, 0.8);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.dw-window-controls button:hover,
.dw-window-controls button:focus-visible {
  color: #ffffff;
  background: rgba(79, 197, 232, 0.18);
  outline: 0;
}

.dw-window-controls .dw-window-close:hover,
.dw-window-controls .dw-window-close:focus-visible {
  background: #c9454a;
}

.dw-window-controls ion-icon {
  width: 17px;
  height: 17px;
  pointer-events: none;
}

body.dw-web-platform .dw-titlebar {
  display: none;
}

body.dw-window.dw-web-platform {
  min-height: 100vh;
  min-height: 100dvh;
  display: block;
}

body.dw-web-platform .dw-window-controls,
body.dw-web-platform .dw-app-menu,
body.dw-web-platform .dw-about {
  display: none;
}

body.dw-window.dw-web-platform > #app,
body.dw-window.dw-web-platform > .call-shell {
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
}

@media (max-width: 540px) {
  body.dw-window.dw-web-platform > #app,
  body.dw-window.dw-web-platform > .call-shell {
    padding-top: env(safe-area-inset-top);
  }
}

.dw-app-menu {
  position: fixed;
  z-index: 1200;
  top: calc(var(--dw-titlebar-height) + 6px);
  left: 8px;
  width: 300px;
  overflow: hidden;
  padding: 7px;
  border: 1px solid rgba(92, 180, 207, 0.28);
  border-radius: 8px;
  color: #eff8fa;
  background: #102731;
  box-shadow: 0 18px 46px rgba(2, 13, 18, 0.34);
  animation: dw-menu-in 150ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.dw-app-menu[hidden],
.dw-about[hidden] {
  display: none;
}

.dw-menu-heading {
  min-width: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 5px 7px 10px;
}

.dw-menu-heading img {
  width: 42px;
  height: 36px;
  object-fit: contain;
}

.dw-menu-heading span,
.dw-menu-heading strong,
.dw-menu-heading small {
  min-width: 0;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dw-menu-footer {
  padding: 10px 12px 4px;
  color: #85a4ae;
  font-size: 11px;
  text-align: center;
}

.dw-menu-heading strong {
  font-size: 13px;
}

.dw-menu-heading small {
  margin-top: 2px;
  color: #85a4ae;
  font-size: 10px;
}

.dw-app-menu > button {
  width: 100%;
  min-height: 38px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  color: #dcebef;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.dw-app-menu > button:hover,
.dw-app-menu > button:focus-visible {
  color: #ffffff;
  background: #173a46;
  outline: 0;
}

.dw-app-menu > button ion-icon {
  width: 18px;
  height: 18px;
  color: var(--dw-cyan);
}

.dw-app-menu > button kbd {
  color: #7996a0;
  background: transparent;
  font: 10px system-ui, sans-serif;
}

.dw-app-menu > .dw-menu-danger:hover ion-icon,
.dw-app-menu > .dw-menu-danger:focus-visible ion-icon {
  color: #ff9d9f;
}

.dw-menu-divider {
  display: block;
  height: 1px;
  margin: 6px 8px;
  background: rgba(146, 194, 209, 0.18);
}

.dw-about {
  position: fixed;
  z-index: 1400;
  inset: var(--dw-titlebar-height) 0 0;
  display: grid;
  place-items: center;
  padding: 18px;
}

.dw-about-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(3, 14, 19, 0.56);
}

.dw-about-panel {
  position: relative;
  width: min(380px, 100%);
  padding: 30px 28px 26px;
  border: 1px solid rgba(87, 196, 227, 0.34);
  border-radius: 8px;
  color: #eff9fb;
  background: #102832;
  box-shadow: 0 22px 62px rgba(2, 14, 20, 0.42);
  text-align: center;
  animation: dw-about-in 180ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.dw-about-panel > img {
  width: 124px;
  height: 100px;
  object-fit: contain;
}

.dw-about-panel h1 {
  margin: 7px 0 0;
  font-size: 22px;
  letter-spacing: 0;
}

.dw-about-panel p {
  margin: 7px 0 14px;
  color: #a8c3cc;
}

.dw-about-panel small {
  color: var(--dw-gold);
}

.dw-about-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #c8dde3;
  background: transparent;
  cursor: pointer;
}

.dw-about-close:hover,
.dw-about-close:focus-visible {
  color: #ffffff;
  background: rgba(79, 197, 232, 0.16);
  outline: 0;
}

.dw-about-close ion-icon {
  width: 20px;
  height: 20px;
}

.dw-window-blurred .dw-titlebar {
  filter: saturate(0.72);
}

@keyframes dw-beacon {
  0%, 100% { opacity: 0.54; }
  50% { opacity: 1; }
}

@keyframes dw-menu-in {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes dw-about-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 640px) {
  .dw-titlebar {
    grid-template-columns: minmax(168px, auto) minmax(36px, 1fr) auto;
  }

  .dw-product-copy small,
  .dw-drag-zone span:last-child {
    display: none;
  }

  .dw-drag-zone {
    padding: 0 5px;
  }
}

@media (max-width: 540px) {
  .dw-titlebar {
    grid-template-columns: 54px minmax(28px, 1fr) auto;
  }

  .dw-product-handle {
    grid-template-columns: 38px;
  }

  .dw-product-copy,
  .dw-product-handle > ion-icon {
    display: none;
  }

  .dw-app-menu {
    width: min(300px, calc(100vw - 16px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .dw-drag-beacon,
  .dw-app-menu,
  .dw-about-panel {
    animation: none;
  }

  .dw-window-controls {
    transition: none;
  }
}
