.global-test-notice-stack {
  position: fixed;
  top: var(--liem-fixed-notice-top, 66px);
  right: calc(env(safe-area-inset-right, 0px) + 16px);
  z-index: 20000;
  width: min(458px, calc(100vw - 32px));
  pointer-events: none;
  overflow: visible;
  isolation: isolate;
  box-sizing: border-box;
  font-family: Quicksand, Arial, sans-serif;
  font-size: 16px;
}

.global-test-notice-stack::before {
  content: attr(data-notice-count) " notifications";
  position: absolute;
  top: 2px;
  right: 28px;
  z-index: 8;
  display: none;
  padding: 3px 8px;
  border: 1px solid rgba(131, 153, 180, 0.35);
  border-radius: 999px;
  background: rgba(25, 29, 35, 0.98);
  color: #aebdce;
  font-size: 0.66rem;
  font-weight: 800;
  line-height: 1.25;
  pointer-events: none;
}

.global-test-notice-stack__toggle {
  display: block;
  margin: 0 20px 0 auto;
  padding: 6px 10px;
  min-height: 32px;
  border: 1px solid #52627a;
  border-radius: 8px;
  background: #20252d;
  color: #eef4fc;
  font: 700 12px/1.4 Quicksand, Arial, sans-serif;
  cursor: pointer;
  pointer-events: auto;
}
.global-test-notice-stack__toggle:focus-visible { outline: 2px solid #68b9ff; outline-offset: 2px; }
.global-test-notice-stack__toggle[hidden],
.global-test-notice-stack[data-notice-count="0"] { display: none; }

.global-test-notice-stack.is-collapsed > .global-test-notice-stack__scroller { display: none; }
.global-test-notice-stack.is-collapsed.has-fresh-notice > .global-test-notice-stack__scroller { display: flex; }
.global-test-notice-stack.is-collapsed .global-test-notice:not(.is-freshly-revealed):not(.is-leaving),
.global-test-notice-stack.is-collapsed .global-test-notice.is-minimized { display: none !important; }
.global-test-notice-stack.is-collapsed .global-test-notice.is-freshly-revealed:not(.is-minimized) {
  display: grid !important;
  opacity: 1;
  transform: translateX(0);
  animation: noticePopIn 0.32s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.global-test-notice-stack.is-collapsed .global-test-notice.is-leaving {
  display: grid !important;
}

.global-test-notice-stack__scroller {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 14px;
  max-height: calc(var(--liem-notice-max-height, calc(100dvh - var(--liem-fixed-notice-top, 66px) - 12px)) - 32px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  box-sizing: border-box;
  padding: 8px 20px 24px;
  pointer-events: auto;
}

@keyframes noticePopIn {
  0% {
    opacity: 0;
    transform: translateX(24px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes noticeSlideOut {
  0% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(36px) scale(0.96);
  }
}

/* Notice size and layout stay stable. A hover must not reflow an unrelated
   update card; a bounded list is readable immediately and scrolls only when
   there are more notices than fit on screen. */
@keyframes updatePulse {
  0% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.02); filter: brightness(1.2); }
  100% { transform: scale(1); filter: brightness(1); }
}
.global-test-notice.has-update-pulse {
  animation: updatePulse 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.global-test-notice-stack__scroller > .global-test-notice { flex: 0 0 auto; }

.global-test-notice {
  --notice-tone: #2e6bd0;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  overflow: hidden;
  padding: 14px 15px 18px;
  border: 1px solid rgba(82, 145, 238, 0.62);
  border-radius: 13px;
  background: rgba(22, 25, 31, 0.985);
  color: #f4f8ff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35), inset 3px 0 0 var(--notice-tone);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  opacity: 0;
  transform: translateX(22px);
  transition: opacity 0.24s ease, transform 0.34s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
  will-change: opacity, transform;
  pointer-events: auto;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.global-test-notice.is-visible,
.global-test-notice.is-freshly-revealed {
  opacity: 1;
  transform: translateX(0);
  animation: noticePopIn 0.32s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.global-test-notice.is-leaving {
  display: grid !important;
  pointer-events: none !important;
  animation: noticeSlideOut 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}
.global-test-notice[data-status="approved"] { --notice-tone: #55b65c; border-color: rgba(85, 182, 92, 0.62); }
.global-test-notice[data-status="preflight"],
.global-test-notice[data-status="starting"] { --notice-tone: #d4b348; border-color: rgba(212, 179, 72, 0.62); }
.global-test-notice[data-status="active"] { --notice-tone: #52a9ee; border-color: rgba(82, 169, 238, 0.68); }
.global-test-notice[data-status="saved"],
.global-test-notice[data-status="submitted"] { --notice-tone: #55b65c; border-color: rgba(85, 182, 92, 0.62); }
.global-test-notice[data-status="locked"],
.global-test-notice[data-status="rejected"],
.global-test-notice[data-status="expired"],
.global-test-notice.has-error { --notice-tone: #dd554b; border-color: rgba(221, 85, 75, 0.62); }
.global-test-notice__copy { display: grid; gap: 3px; min-width: 0; }
.global-test-notice__title { font-size: 0.94rem; letter-spacing: 0.01em; }
.global-test-notice__detail,
.global-test-notice__time { color: #aebdce; font-size: 0.76rem; line-height: 1.35; }
.global-test-notice__actions { display: flex; align-items: center; justify-content:flex-end; gap: 7px; flex-wrap:wrap; min-width:0; }
.global-test-notice__actions button {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid rgba(135, 184, 255, 0.34);
  border-radius: 8px;
  background: #2e6bd0;
  color: #fff;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}
.global-test-notice__actions button.is-reject { background: #9f3732; border-color: #c75e59; }
.global-test-notice__actions button.is-secondary { background: #283546; }
.global-test-notice__actions button.is-dismiss {
  min-width: 32px;
  width: 32px;
  padding: 4px;
  background: #262b32;
  border-color: #49515b;
  color: #bdc7d2;
  font-size: 1.05rem;
  line-height: 1;
}
.global-test-notice__actions button:disabled { opacity: 0.52; cursor: wait; }
.global-test-notice__progress { position: absolute; right: 0; bottom: 0; left: 0; height: 4px; background: rgba(255,255,255,0.08); }
.global-test-notice__progress i { display: block; width: 100%; height: 100%; background: var(--notice-tone); transform-origin: left; transition: transform 0.25s linear; }

@media (max-width: 620px) {
  .global-test-notice { grid-template-columns: 1fr; }
  .global-test-notice__actions { justify-content: flex-end; }
}

@media (max-width: 430px) {
  .global-test-notice-stack {
    right: max(8px, env(safe-area-inset-right, 0px));
    left: max(8px, env(safe-area-inset-left, 0px));
    width: auto;
  }
  .global-test-notice-stack__scroller { padding: 8px 8px 24px; }
  .global-test-notice-stack__toggle { margin-right: 8px; }
  .global-test-notice-stack::before { right: 14px; }
  .global-test-notice { padding: 12px 12px 16px; gap: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  html:not(.liem-motion-enabled) .global-test-notice {
    transition-duration: 0.01ms;
    transition-delay: 0ms;
    animation-delay: 0ms;
    animation-duration: 0.01ms;
    animation-name: none !important;
  }
  html:not(.liem-motion-enabled) .global-test-notice { will-change: auto; }
}

.global-test-notice.is-minimized {
  grid-template-columns: minmax(0, 1fr) auto !important;
  padding: 6px 12px !important;
  min-height: 38px !important;
  align-items: center !important;
  border-radius: 999px !important;
  background: rgba(22, 25, 31, 0.95) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}
.global-test-notice.is-minimized .global-test-notice__copy {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  overflow: hidden !important;
}
.global-test-notice.is-minimized .global-test-notice__title {
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
.global-test-notice.is-minimized .global-test-notice__detail,
.global-test-notice.is-minimized .global-test-notice__time,
.global-test-notice.is-minimized .global-test-notice__progress {
  display: none !important;
}
.global-test-notice.is-minimized .global-test-notice__actions {
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
}
.global-test-notice.is-minimized .global-test-notice__actions button:not(.is-dismiss):not(.is-primary) {
  display: none !important;
}
.global-test-notice.is-minimized .global-test-notice__actions button.is-primary {
  padding: 3px 8px !important;
  font-size: 0.7rem !important;
  min-height: 24px !important;
}
.global-test-notice.is-minimized .global-test-notice__actions button.is-dismiss {
  width: 24px !important;
  height: 24px !important;
  padding: 0 !important;
  font-size: 16px !important;
  line-height: 22px !important;
}

@media (max-width: 620px) {
  .global-test-notice-stack {
    top: var(--liem-fixed-notice-top, 56px);
    right: calc(env(safe-area-inset-right, 0px) + 8px);
    left: calc(env(safe-area-inset-left, 0px) + 8px);
    width: auto;
    max-width: 100%;
  }

  .global-test-notice-stack.is-collapsed > .global-test-notice-stack__scroller,
  .global-test-notice-stack.is-collapsed.has-fresh-notice > .global-test-notice-stack__scroller {
    display: none !important;
  }

  .global-test-notice-stack__toggle {
    margin: 0 0 0 auto;
    padding: 5px 9px;
    min-height: 28px;
    font-size: 11px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  }

  .global-test-notice-stack__scroller {
    padding: 6px 0 16px;
    gap: 10px;
    max-height: calc(100dvh - var(--liem-fixed-notice-top, 56px) - 24px);
  }

  .global-test-notice {
    padding: 10px 12px;
    gap: 8px;
    border-radius: 10px;
    font-size: 14px;
  }

  .global-test-notice__title {
    font-size: 0.88rem;
  }

  .global-test-notice__detail {
    font-size: 0.78rem;
  }

  .global-test-notice__actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  .global-test-notice__actions button {
    padding: 5px 9px;
    font-size: 0.75rem;
    min-height: 28px;
  }
}

