@import url("design-system.css");

:root {
  --wt-theme-primary: #004b7c;
  --wt-theme-primary-strong: #035a96;
  --wt-theme-primary-bright: #0b63a6;
  --wt-theme-primary-dark: #033a60;
  --wt-theme-primary-deep: #00324f;
  --wt-theme-primary-soft: #cbd5f5;
  --wt-theme-primary-mist: #e6f3ff;

  --wt-theme-text: #0f172a;
  --wt-text-primary: #0f172a;
  --wt-background: #ffffff;
  --wt-surface: #ffffff;
  --wt-font-stack: 'Segoe UI','Inter',Arial,sans-serif;
  --wt-theme-btn-radius: 12px;
  --wt-theme-btn-shadow: 0 10px 20px rgba(15,23,42,0.16);
}

/* ===== GLOBAL SCROLL SAFETY ===== */
/* Ensure html/body always allow vertical scrolling by default.
   Pages must explicitly opt-out (e.g., inbox chat layout). */
html {
  overflow-y: auto;
  overflow-x: hidden;
}

body {
  font-family: var(--wt-font-stack);
  color: var(--wt-text-primary, #0f172a);
  background: var(--wt-background, #ffffff);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Only block body scroll when a modal overlay is ACTUALLY visible.
   Uses :has() to prevent the stuck-class scenario from killing scroll. */
body.wt-modal-open:has(
  .wt-modal[data-open="true"],
  .wt-modal-overlay[data-open="true"],
  .wt-modal-overlay--open,
  .wt-improve-overlay.is-open,
  .wt-confirm-modal[data-open="true"],
  [data-wt-sme-profile-modal][data-open="true"],
  [data-wt-inbox-modal][data-open="true"]
) {
  overflow: hidden !important;
}

/* Fallback for stuck wt-modal-open: if no modal is actually visible, allow scroll */
body.wt-modal-open:not(:has(
  .wt-modal[data-open="true"],
  .wt-modal-overlay[data-open="true"],
  .wt-modal-overlay--open,
  .wt-improve-overlay.is-open,
  .wt-confirm-modal[data-open="true"],
  [data-wt-sme-profile-modal][data-open="true"],
  [data-wt-inbox-modal][data-open="true"]
)) {
  overflow-y: auto !important;
}

/* Similarly for other scroll-blocking classes */
body.wt-improve-blur-active:has(.wt-improve-overlay.is-open) {
  overflow: hidden !important;
}
body.wt-improve-blur-active:not(:has(.wt-improve-overlay.is-open)) {
  overflow-y: auto !important;
}
body.wt-more-open:has(.wt-more-overlay[data-open="true"], .wt-more-overlay--open) {
  overflow: hidden !important;
}
body.wt-more-open:not(:has(.wt-more-overlay[data-open="true"], .wt-more-overlay--open)) {
  overflow-y: auto !important;
}
body.settings-modal-open:has(.settings-modal-backdrop.active) {
  overflow: hidden !important;
}
body.settings-modal-open:not(:has(.settings-modal-backdrop.active)) {
  overflow-y: auto !important;
}

.wt-tip-trigger-wrap {
  position: relative;
  z-index: 15000;
  overflow: visible;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  margin-left: 0;
}

.wt-tip-trigger {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(15,23,42,0.08);
  color: #0f172a;
  font-size: 10px;
  border: 1px solid rgba(148,163,184,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(15,23,42,0.12);
  cursor: pointer;
  padding: 0;
}

.wt-tip-panel {
  position: absolute;
  left: calc(100% + 12px);
  right: auto;
  top: -12px;
  width: 280px;
  background: rgba(255,255,255,0.96);
  border-radius: 12px;
  padding: 6px 8px;
  box-shadow: 0 24px 48px rgba(15,23,42,0.2);
  border: 1px solid rgba(226,232,240,0.9);
  display: none;
  z-index: 99999;
  backdrop-filter: blur(12px);
}

.wt-tip-trigger-wrap:hover .wt-activity-legend-panel,
.wt-tip-trigger-wrap:focus-within .wt-activity-legend-panel {
  display: block;
}

.wt-activity-live-group {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
  overflow: visible;
}

.wt-activity-legend-panel {
  position: absolute;
  top: 50%;
  right: calc(100% + 12px);
  left: auto;
  transform: translate(-2px, 24px);
  width: 240px;
  padding: 10px 12px;
  min-width: 200px;
  box-shadow: 0 12px 28px rgba(15,23,42,0.18);
  z-index: 99999;
  display: none;
  border: 1px solid rgba(226,232,240,0.9);
  border-radius: 12px;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(12px);
}

.wt-activity-legend-heading {
  font-size: 11px;
  font-weight: 600;
  color: #0b3855;
  margin-bottom: 6px;
}

.wt-activity-legend-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 11px;
  color: #1f2937;
  gap: 6px;
  display: flex;
  flex-direction: column;
}

.wt-activity-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wt-activity-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-flex;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
}

.wt-tip-panel ul {
  margin: 0;
  padding-left: 16px;
  font-size: 9px;
  color: #333;
}

/* Ensure tip popups are not themed */
.wt-tip-trigger,
.wt-tip-panel,
.wt-activity-legend-panel,
.wt-activity-legend-heading {
  color: #0f172a !important;
}
.wt-tip-trigger {
  background: rgba(15,23,42,0.08) !important;
  border: 1px solid rgba(148,163,184,0.35) !important;
  box-shadow: 0 4px 10px rgba(15,23,42,0.12) !important;
}
.wt-tip-panel,
.wt-activity-legend-panel {
  background: rgba(255,255,255,0.96) !important;
  border: 1px solid rgba(226,232,240,0.9) !important;
}

.wt-tip-trigger-wrap:hover .wt-tip-panel,
.wt-tip-trigger-wrap:focus-within .wt-tip-panel {
  display: block;
}

/* ===== Live activity card ===== */
.wt-side-card--activity {
  position: relative;
  z-index: 3;
  isolation: isolate;
  background: rgba(245,250,255,0.95);
  overflow: visible;
}

.wt-activity-title {
  align-items: center;
  overflow: visible;
}

.wt-activity-live {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--wt-theme-primary-deep, #0b3855);
  background: var(--wt-theme-primary-mist, #e7f2ff);
  border: 1px solid #c5def5;
  border-radius: 999px;
  padding: 2px 6px;
}

.wt-activity-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #22c55e;
  animation: wt-live-pulse 1.8s ease-in-out infinite;
}

.wt-activity-list {
  margin: 4px 0 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
  --wt-activity-item-height: 52px;
  max-height: calc(var(--wt-activity-item-height) * 3.5);
  overflow-y: auto;
  overflow-x: hidden;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.wt-activity-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(226,232,240,0.9);
  box-shadow: 0 2px 6px rgba(15,23,42,0.10);
  cursor: default;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.wt-activity-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(15,23,42,0.16);
  border-color: #c7d2e5;
}

.wt-activity-item.wt-activity-clickable {
  cursor: pointer;
}

.wt-activity-item.wt-activity-new {
  animation: wt-pop-in 0.25s ease;
}

.wt-activity-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wt-activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #0a84ff;
  box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.12);
  flex-shrink: 0;
}

.wt-activity-text {
  font-size: 10px;
  font-weight: 600;
  color: var(--wt-theme-primary-deep, #0b3855);
  line-height: 1.3;
}

.wt-activity-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 9px;
  color: #6b7280;
}

.wt-activity-meta-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wt-activity-time {
  flex-shrink: 0;
  color: #64748b;
}

.wt-activity-report {
  font-size: 9px;
  color: var(--wt-theme-primary-deep, #0b3855);
  background: linear-gradient(120deg, rgba(224,242,254,0.9), rgba(248,250,252,0.9));
  border: 1px solid rgba(148,163,184,0.45);
  border-radius: 8px;
  padding: 4px 6px;
  line-height: 1.35;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.6);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wt-activity-ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--wt-theme-primary-deep, #0b3855);
  background: rgba(99,102,241,0.12);
  border: 1px solid rgba(99,102,241,0.35);
  border-radius: 999px;
  padding: 1px 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.wt-activity-empty {
  color: #6b7280;
  font-size: 9px;
  padding: 6px 8px;
}

.wt-activity-item[data-type="completed"] .wt-activity-dot {
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34,197,94,0.15);
}

.wt-activity-item[data-type="updated"] .wt-activity-dot {
  background: #0ea5e9;
  box-shadow: 0 0 0 2px rgba(14,165,233,0.18);
}

.wt-activity-item[data-type="created"] .wt-activity-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245,158,11,0.18);
}

.wt-activity-item[data-type="assigned"] .wt-activity-dot {
  background: #4f46e5;
  box-shadow: 0 0 0 2px rgba(79,70,229,0.18);
}

.wt-top-search-area,
.wt-search-row,
.wt-search-line,
.wt-search-topline {
  position: relative;
  z-index: 9998;
}

.wt-btn,
.wt-primary-btn,
.wt-theme-btn {
  position: relative;
  top: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  font-family: Arial, sans-serif;
  font-size: 9px;
  padding: 4px 10px;
  border: none;
  background: linear-gradient(90deg, var(--wt-theme-primary-mist, #e6eef7), #ffffff);
  color: var(--wt-theme-primary, #004b7c);
  cursor: pointer;
  transition:
    box-shadow 0.16s ease,
    transform 0.16s ease,
    background-color 0.16s ease,
    color 0.16s ease;
  text-decoration: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  box-sizing: border-box;
  max-width: 220px;
}

.wt-subtle-btn,
.wt-btn-ghost,
.wt-btn-amber {
  border-radius: var(--wt-theme-btn-radius) !important;
}

.wt-dash-icon-btn.wt-dash-icon-btn--active {
  background: #ffe066 !important;
  color: var(--wt-text-primary, #0f172a) !important;
}

.wt-dash-icon-btn.wt-dash-icon-btn--active:hover,
.wt-dash-icon-btn.wt-dash-icon-btn--active:focus {
  background: #ffe066 !important;
  color: var(--wt-text-primary, #0f172a) !important;
}
@keyframes wt-bookmark-pop {
  0% {
    transform: scale(1);
    background: var(--wt-text-primary, #0f172a);
    box-shadow: 0 0 0 0 rgba(255,216,0,0.5);
  }
  60% {
    transform: scale(1.25);
    background: #ffe066;
    box-shadow: 0 0 12px 6px rgba(255,216,0,0.35);
  }
  100% {
    transform: scale(1);
    background: var(--wt-text-primary, #0f172a);
    box-shadow: 0 0 0 0 rgba(255,216,0,0);
  }
}

@keyframes wt-live-pulse {
  0%   { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45); }
  70%  { transform: scale(1); box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
  100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.wt-dash-icon-btn.wt-bookmark-pop {
  animation: wt-bookmark-pop 0.38s cubic-bezier(.4,1.6,.6,1) 1;
  background: #ffe066 !important;
  color: var(--wt-text-primary, #0f172a) !important;
}

/* Detail-head and more-topbar keep their theme header styling */
.wt-detail-head,
.wt-more-topbar {
  background: linear-gradient(90deg,var(--wt-theme-primary),var(--wt-theme-primary-strong)) !important;
  color: #ffffff !important;
  border-bottom: 1px solid rgba(255,255,255,0.2) !important;
}

.wt-detail-head *,
.wt-more-topbar * {
  color: #ffffff !important;
}

.wt-detail-close,
.wt-more-close {
  color: #ffffff !important;
  background: rgba(255,255,255,0.18) !important;
  border: 1px solid rgba(255,255,255,0.35) !important;
  box-shadow: none !important;
}

.wt-more-close svg {
  stroke: #ffffff !important;
}

.wt-detail-close svg,
.wt-detail-close svg path,
.wt-more-close svg path {
  fill: #ffffff !important;
  stroke: #ffffff !important;
}

/* Modal inner panels keep white background */
.wt-modal-inner,
.wt-modal-body,
.wt-modal-footer,
.wt-modal-panel {
  background: #ffffff;
}

/* Modal overlay — clean dark tint, no backdrop-filter (prevents whiteout) */
.wt-modal-overlay,
.wt-more-backdrop {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: rgba(15, 23, 42, 0.45);
}

/* SAFETY: prevent backdrop-filter whiteout on full-screen overlays.
   Small decorative elements (tooltips, search bar) keep their blur. */
.wt-modal,
.wt-modal-overlay,
.wt-more-backdrop,
.wt-upload-modal,
.wt-assess-modal-backdrop,
.wt-ai-overlay,
.wt-settings-overlay,
.st-editor-overlay,
.st-wizard-overlay,
.rm-drawer-overlay,
.rm-sidebar-overlay,
[data-wt-feedback-backdrop],
[data-wt-notif-panel],
[data-wt-settings-panel],
#wt-page-loader {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

/* Block interaction with page content when modal is open — but keep it VISIBLE */
body.wt-modal-open .wt-page-frame,
body.wt-modal-open .wt-page-shell,
body.wt-modal-open .wt-hero,
body.wt-modal-open .wt-edit-fab,
body.wt-modal-open .wt-ai-fab,
body.wt-modal-open [data-wt-edit-toggle],
body.wt-modal-open .wt-topbar,
body.wt-modal-open .wt-nav {
  pointer-events: none !important;
}
/* Ensure page content stays visible behind modal overlay.
   Uses html qualifier for higher specificity than security-guard.js
   'body:not(.wt-page-ready){opacity:0!important}' rule. */
html body.wt-modal-open,
body.wt-modal-open .wt-page-shell,
body.wt-modal-open .wt-page-frame,
body.wt-modal-open .wt-page-bg {
  opacity: 1 !important;
  visibility: visible !important;
  filter: none !important;
}

/* Safety: keep invisible overlays from blocking clicks.
   EXCEPTION: #wtDeptAddModal / #wtEditProfileModal with data-open="true"
   must NEVER be hidden — the ID override below handles that. */
.wt-modal[data-open="false"],
body:not(.wt-modal-open) .wt-modal-overlay:not([data-open="true"]),
body:not(.wt-more-open) .wt-more-backdrop,
body:not(.wt-modal-open) .wt-ai-overlay:not(.is-open),
body:not(.wt-modal-open) [data-wt-feedback-backdrop="true"]:not([data-open="true"]),
body:not(.wt-modal-open) [data-wt-notif-panel="true"]:not([data-wt-panel-open="true"]),
body:not(.wt-modal-open) [data-wt-settings-panel="true"]:not([data-wt-panel-open="true"]) {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  display: none !important;
}

/* Feedback backdrop visible when explicitly open */
[data-wt-feedback-backdrop="true"][data-open="true"] {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

/* CRITICAL: Override hiding rules when modal is open - make it visible! */
body.wt-modal-open .wt-modal-overlay[data-open="true"],
body.wt-modal-open .wt-mat-picker-overlay {
  opacity: 1 !important;
  visibility: visible !important;
  display: flex !important;
  pointer-events: auto !important; /* Interactive when open */
}

/* Ensure ANY modal overlay with data-open="true" is ALWAYS visible,
   even if body.wt-modal-open gets stripped by background scripts. */
.wt-modal-overlay[data-open="true"] {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
  align-items: center !important;
  justify-content: center !important;
}

body.wt-modal-open .wt-modal[data-open="true"] {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important; /* Inner modal interactive */
  display: flex !important;
}

/* Ensure nested/higher-z-index modals always appear and are interactive */
.wt-modal-overlay.wt-modal-overlay--open,
.wt-modal-overlay.wt-modal-overlay--open .wt-modal,
#wtSopEditModal[data-open="true"] .wt-modal-inner,
#wtSopDeleteConfirm[data-open="true"] .wt-modal-inner {
  pointer-events: auto !important;
}

/* Keep modal backgrounds non-interactive so clicks pass through to page behind */
#wtSopEditModal,
#wtSopDeleteConfirm {
  pointer-events: none !important;
}

.wt-modal input:focus,
.wt-modal textarea:focus,
.wt-modal select:focus,
.wt-modal-panel input:focus,
.wt-modal-panel textarea:focus,
.wt-modal-panel select:focus,
.wt-modal-search:focus,
.wt-searchwrap input:focus,
.wt-left-search input:focus {
  border-color: #94a3b8 !important;
  box-shadow: 0 0 0 2px rgba(148,163,184,0.25) !important;
  outline: none !important;
}

.wt-search-form {
  border-color: rgba(210,218,230,0.9) !important;
}

.wt-search-form:hover,
.wt-search-form:focus-within {
  border-color: #c3cddd !important;
  box-shadow: 0 10px 24px rgba(15,23,42,0.14), 0 3px 8px rgba(15,23,42,0.08) !important;
}

.wt-search-row {
  margin-bottom: 0;
  position: relative;
  max-width: 520px;
  width: 100%;
}

.wt-search-topline,
.wt-search-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 20px;
}

.wt-search-stack {
  position: relative;
  flex: 1;
  max-width: 100%;
  min-width: 0;
}

.wt-search-form {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  background: rgba(255,255,255,0.92) !important;
  border-radius: 999px !important;
  padding: 2px 8px 2px 12px !important;
  min-height: 26px !important;
  box-shadow: 0 10px 24px rgba(15,23,42,0.14), 0 3px 8px rgba(15,23,42,0.08) !important;
  border: 1px solid rgba(210,218,230,0.9) !important;
  backdrop-filter: blur(14px);
  transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
  width: 100%;
}
.wt-search-form:hover {
  box-shadow: 0 14px 30px rgba(15,23,42,0.16), 0 4px 10px rgba(15,23,42,0.10) !important;
  transform: none;
  border-color: #c3cddd !important;
}
.wt-search-form::after {
  content: attr(data-suggestion);
  position: absolute;
  left: 12px;
  right: 34px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(15,23,42,0.28);
  font-size: 10.5px;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  opacity: 0.85;
  transition: opacity 0.25s ease;
}
.wt-search-form.is-typing::after,
.wt-search-form.wt-suggest-fade::after { opacity: 0; }

.wt-search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 11px;
  line-height: 1.3;
  height: 20px;
  background: transparent;
  color: #0f172a;
  position: relative;
  z-index: 1;
}
.wt-search-input::placeholder { color: #9aa7bd; }

.wt-search-btn {
  border: none;
  border-radius: 999px !important;
  width: 22px;
  height: 22px;
  padding: 0;
  font-size: 10px;
  cursor: pointer;
  background: var(--wt-theme-primary, #0a84ff);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 6px 14px rgba(15,23,42,0.18);
  transition: background-color 0.2s ease, box-shadow 0.16s ease, transform 0.16s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.wt-search-btn:hover {
  background: var(--wt-theme-primary-strong, #035a96);
  box-shadow: 0 10px 20px rgba(15,23,42,0.22);
  transform: translateY(-1px);
}
.wt-search-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wt-filter-search input:focus {
  border-color: #94a3b8 !important;
  box-shadow: 0 0 0 2px rgba(148,163,184,0.25) !important;
}

/* ========================================
   RUNMY LEARNING HUB - SHARED BASE CSS
   ======================================== */

/* ── Critical topnav styles ──
   Loaded early so the topnav skeleton (injected by security-guard.js)
   is styled before any deferred JS runs. Prevents FOUC on cold cache. */
.ai-topnav {
  position: relative;
  z-index: 500;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 32px;
  box-sizing: border-box;
}
.ai-topnav-inner {
  max-width: var(--wt-shell-width, 1620px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 56px;
}
.ai-topnav-spacer {
  height: 0;
  width: 100%;
  flex-shrink: 0;
}

/* ── Page-enter transition system ──
   Body starts invisible; security-guard.js adds .wt-page-ready after
   auth check + loader dismissal to trigger a smooth reveal.
   Uses Apple-style spring easing with subtle scale + blur for a
   premium feel across every page.                                       */

body {
  opacity: 0;
  will-change: opacity, filter;
}
body.wt-page-ready {
  opacity: 1 !important;
  animation: wt-page-reveal 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes wt-page-reveal {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ═════════════════════════════════════════════════════════════════════════════
   FIX: Ensure floating action buttons (Ask AI, Improve, Notes, Edit) stay
   fixed to viewport when scrolling. The wt-page-reveal animation uses transforms
   which create a containing block that breaks position:fixed. Override here.
   ═════════════════════════════════════════════════════════════════════════════ */
html, body,
body.wt-page-ready {
  transform: none !important;
  will-change: auto !important;
  contain: none !important;
  perspective: none !important;
  filter: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

/* Force all right-side FABs to stay fixed on screen */
.wt-ask-ai-fab,
.wt-improve-fab,
.wt-edit-fab-panel,
.wt-notes-fab,
.wt-ideas-fab,
.wt-voice-hist-fab,
.wt-coach-fab,
.wt-fab,
.wt-fab-container,
.wt-floating-save,
[data-wt-edit-fab],
[data-wt-ask-ai-fab],
[data-wt-improve-fab],
[data-wt-notes-fab],
[data-wt-ideas-btn],
[data-wt-voice-hist-btn],
[data-wt-coach-fab] {
  position: fixed !important;
  z-index: 9999 !important;
}

/* Staggered children — common layout wrappers auto-animate */
body.wt-page-ready .wt-topbar,
body.wt-page-ready .wt-page-header,
body.wt-page-ready .wt-header-main,
body.wt-page-ready .wt-admin-topbar,
body.wt-page-ready .wt-search-bar-row {
  opacity: 0;
  animation: wt-enter-fade-up 0.64s cubic-bezier(0.16, 1, 0.3, 1) 0.06s forwards;
}
body.wt-page-ready .wt-dashboard-main,
body.wt-page-ready .wt-page-bg,
body.wt-page-ready .wt-card-main,
body.wt-page-ready .wt-admin-panel-board,
body.wt-page-ready .wt-gmi-main,
body.wt-page-ready .wt-login-card,
body.wt-page-ready .wt-content-shell,
body.wt-page-ready .wt-main-content,
body.wt-page-ready main {
  opacity: 0;
  animation: wt-enter-fade-up 0.72s cubic-bezier(0.16, 1, 0.3, 1) 0.12s forwards;
}

/* Utility: add data-wt-enter="1" through "6" for custom stagger */
body.wt-page-ready [data-wt-enter="1"] { opacity:0; animation: wt-enter-fade-up 0.56s cubic-bezier(0.16,1,0.3,1) 0.06s forwards; }
body.wt-page-ready [data-wt-enter="2"] { opacity:0; animation: wt-enter-fade-up 0.56s cubic-bezier(0.16,1,0.3,1) 0.12s forwards; }
body.wt-page-ready [data-wt-enter="3"] { opacity:0; animation: wt-enter-fade-up 0.56s cubic-bezier(0.16,1,0.3,1) 0.18s forwards; }
body.wt-page-ready [data-wt-enter="4"] { opacity:0; animation: wt-enter-fade-up 0.56s cubic-bezier(0.16,1,0.3,1) 0.24s forwards; }
body.wt-page-ready [data-wt-enter="5"] { opacity:0; animation: wt-enter-fade-up 0.56s cubic-bezier(0.16,1,0.3,1) 0.30s forwards; }
body.wt-page-ready [data-wt-enter="6"] { opacity:0; animation: wt-enter-fade-up 0.56s cubic-bezier(0.16,1,0.3,1) 0.36s forwards; }

@keyframes wt-enter-fade-up {
  from {
    opacity: 0;
    filter: blur(4px);
    transform: translateY(18px) scale(0.99);
  }
  to {
    opacity: 1;
    filter: none;
    transform: none;
  }
}

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  body, body.wt-page-ready,
  body.wt-page-ready .wt-topbar,
  body.wt-page-ready .wt-page-header,
  body.wt-page-ready .wt-header-main,
  body.wt-page-ready .wt-admin-topbar,
  body.wt-page-ready .wt-search-bar-row,
  body.wt-page-ready .wt-dashboard-main,
  body.wt-page-ready .wt-page-bg,
  body.wt-page-ready .wt-card-main,
  body.wt-page-ready .wt-admin-panel-board,
  body.wt-page-ready .wt-gmi-main,
  body.wt-page-ready .wt-login-card,
  body.wt-page-ready .wt-content-shell,
  body.wt-page-ready .wt-main-content,
  body.wt-page-ready main,
  body.wt-page-ready [data-wt-enter] {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
}

/* Global Animations */
@keyframes wt-fade-in-up {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes wt-gradient-shift {
  0%   { background-position: 0% 0%; }
  50%  { background-position: 100% 100%; }
  100% { background-position: 0% 0%; }
}

@keyframes wt-next-glow {
  0%, 100% {
    box-shadow: 0 2px 6px rgba(0,75,124,0.35);
    transform: translateY(0);
  }
  50% {
    box-shadow: 0 0 0 2px rgba(3,90,150,0.35),
                0 8px 20px rgba(0,0,0,0.3);
    transform: translateY(-1px);
  }
}

/* ========================================
   SHARED HEADER (Blue Bar with Logo, Title, Meta)
   ======================================== */

.wt-header-main {
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(15,23,42,0.12);
  background: linear-gradient(180deg, #ffffff, #f1f5f9);
  color: var(--wt-neutral-ink);
  border: 1px solid var(--wt-theme-primary-soft, #dde5ee);
  position: relative;
}
.wt-header-main::before{
  content:"";
  position:absolute;
  left:0;
  right:0;
  top:0;
  height:3px;
  background: linear-gradient(90deg, var(--wt-theme-primary, #004b7c), var(--wt-theme-primary-bright, #0b63a6));
}

.wt-header-main-inner {
  background: transparent;
  padding: 10px 20px 12px;
  min-height: 84px; /* Prevents header from shrinking when meta content changes */
  box-sizing: border-box;
  display: flex;
  align-items: center;
  height: 100%;
}

.wt-header-main-inner > table {
  width: 100%;
  table-layout: fixed;
}

.wt-header-main-inner > table > tbody > tr > td:first-child {
  width: 50%;
}

.wt-logo-wrap {
  margin-right: 14px;
  display: flex;
  align-items: center;
  height: 100%;
}

.wt-logo-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin-top: 0;
  margin-bottom: 0;
  box-sizing: border-box;
}

.wt-logo-link:hover {
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

.wt-logo-link:active {
  box-shadow: 0 3px 10px rgba(0,0,0,0.25);
}

.wt-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 6px;
  background: transparent;
  padding: 0;
  /* Further zoom in on the logo for better readability */
  transform: scale(1.36); /* Increased scale */
  object-position: center 38%;
}

.wt-header-text-block {
  vertical-align: middle;
  padding-left: 28px;
}

/* Subtle pop-up hover effect for app tiles, material rows and buttons */
.wt-app-tile,
.wt-material-row,
.wt-btn {
  transition: transform 280ms cubic-bezier(.16,1,.3,1), box-shadow 280ms cubic-bezier(.16,1,.3,1), background-color 280ms cubic-bezier(.16,1,.3,1);
  will-change: transform, box-shadow;
}

.wt-app-tile:hover,
.wt-material-row:hover,
.wt-btn:hover {
  transform: translateY(-1px) scale(1.005);
  box-shadow: 0 8px 18px rgba(2,6,23,0.12);
}

.wt-btn:not(.wt-btn-next):hover {
  background-color: #eef3f8;
}

.wt-btn img {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-right: 8px;
  border-radius: 6px;
}

.wt-btn span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Slightly stronger pop for primary interactive tiles */
.wt-app-tile--courses:hover,
.wt-app-tile--videos:hover,
.wt-app-tile--docs:hover,
.wt-app-tile--checklists:hover,
.wt-app-tile--jobaids:hover,
.wt-app-tile--tools:hover,
.wt-app-tile--callouts:hover,
.wt-app-tile--contacts:hover {
  transform: translateY(-1px) scale(1);
  box-shadow: 0 10px 24px rgba(2,6,23,0.16);
}

.wt-header-title {
  font-size: 22px;
  font-weight: bold;
  letter-spacing: 0.6px;
  color: var(--wt-theme-primary, #004b7c);
}

.wt-header-subtitle {
  font-size: 11px;
  color: #475569;
  margin-top: 4px;
  max-width: calc(var(--wt-shell-width, 1620px) / 2);
  line-height: 1.35;
  max-height: calc(1.35em * 2);
  padding-bottom: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  white-space: normal;
}

.wt-header-text-block {
  white-space: normal !important;
  max-width: calc(var(--wt-shell-width, 1620px) / 2);
  display: inline-block;
  line-height: 1.2;
}

/* Keep titles neutral and readable across dashboards */
.wt-apps-title,
.wt-step-board-title,
.wt-side-title,
.wt-assigned-title,
.wt-materials-steps-title,
.wt-materials-panel-title,
.wt-app-label,
.wt-app-caption,
.wt-section-title,
.wt-card-title {
  color: var(--wt-neutral-ink) !important;
}

/* Right-side shared meta container (feedback, notifications, bookmarks) */

.wt-header-right {
  text-align: right;
  vertical-align: middle;
  padding-left: 12px;
  min-width: 240px;
  min-height: 60px;
  display: flex;
  align-items: center; /* Center vertically with header */
  justify-content: flex-end;
  height: 100%;
}

#wtDashboardMeta,
#wtHubHeaderMeta {
  display: flex;
  justify-content: flex-end;
  align-items: center; /* Center vertically with header */
  width: 100%;
  min-height: 48px;
  box-sizing: border-box;
  height: 100%;
}

/* Dashboard-only: remove bookmark option (no point bookmarking the dashboard) */
body[data-page-id="main-dashboard"] #wtDashboardMeta [data-wt-bookmark-btn] {
  display: none !important;
}
body[data-page-id="main-dashboard"] [data-wt-dash-topbar="true"] [data-wt-bookmark-btn="true"] {
  display: none !important;
}

/* Shared meta icons styling */
.wt-meta-svg {
  width: 16px;
  height: 16px;
  stroke: #ffffff;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.35));
  pointer-events: none;
}

@keyframes wt-meta-spin {
  to { transform: rotate(360deg); }
}
@keyframes wt-meta-wiggle {
  0%   { transform: rotate(0deg); }
  20%  { transform: rotate(-18deg); }
  40%  { transform: rotate(12deg); }
  60%  { transform: rotate(-8deg); }
  80%  { transform: rotate(6deg); }
  100% { transform: rotate(0deg); }
}
@keyframes wt-meta-pop {
  0%   { transform: translateY(0) scale(1); }
  45%  { transform: translateY(-2px) scale(1.16); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes wt-meta-flip {
  0%   { transform: rotate(0deg) translateY(0); }
  35%  { transform: rotate(-12deg) translateY(-1px); }
  65%  { transform: rotate(10deg) translateY(-2px); }
  100% { transform: rotate(0deg) translateY(0); }
}

[data-wt-actions="true"] .wt-meta-icon {
  transform-origin: 50% 50%;
  transition: transform 0.2s ease;
}
[data-wt-actions="true"] [data-wt-settings-btn="true"]:hover .wt-meta-icon--settings {
  animation: wt-meta-spin 0.9s linear;
}
[data-wt-actions="true"] [data-wt-notif-btn="true"] .wt-meta-icon--notif {
  transform-origin: 50% 18%;
}
[data-wt-actions="true"] [data-wt-notif-btn="true"]:hover .wt-meta-icon--notif {
  animation: wt-meta-wiggle 0.9s ease-in-out;
}
[data-wt-actions="true"] [data-wt-feedback-btn="true"]:hover .wt-meta-icon--feedback {
  animation: wt-meta-pop 0.6s ease-out;
}
[data-wt-actions="true"] [data-wt-bookmark-btn="true"] .wt-meta-icon--bookmark {
  transform-origin: 50% 85%;
}
[data-wt-actions="true"] [data-wt-bookmark-btn="true"]:hover .wt-meta-icon--bookmark {
  animation: wt-meta-flip 0.7s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  [data-wt-actions="true"] .wt-meta-icon {
    animation: none !important;
    transition: none !important;
  }
}

/* Ensure header container creates a proper stacking context so children
   cannot compete with FABs (z-index ~10000) in the root context. */
body[data-page-id="main-dashboard"] #wtHeaderContainer,
body[data-page-id$="-hub"] #wtHeaderContainer {
  position: relative !important;
  z-index: 1000 !important;
}

/* Targeted fixes: ensure shared header visible only on dashboard and hub pages */
body[data-page-id="main-dashboard"] #wtHeaderContainer > *,
body[data-page-id$="-hub"] #wtHeaderContainer > * {
  display: block !important;
  visibility: visible !important;
  position: relative !important;
  z-index: 10 !important;
}

body[data-page-id="main-dashboard"] .wt-header-main,
body[data-page-id$="-hub"] .wt-header-main {
  display: block !important;
  visibility: visible !important;
  position: relative !important;
  z-index: 10 !important;
}

/* Modal headers should always use the theme color */

/* Default buttons stay neutral; primary/next remain theme for key actions */
body:not([data-page-id="main-dashboard"]) .wt-btn:not(.wt-btn-next):not(.wt-btn-primary):not(.wt-btn--primary):not(.wt-primary-btn):not(.wt-theme-btn--primary),
body:not([data-page-id="main-dashboard"]) .wt-btn-ghost,
body:not([data-page-id="main-dashboard"]) .wt-subtle-btn {
  background: #f3f4f6 !important;
  color: var(--wt-neutral-ink) !important;
  border: 1px solid #e2e8f0 !important;
}

/* Soft theme for secondary/medium importance buttons */
.wt-btn-primary,
.wt-primary-btn,
.wt-btn--primary {
  background: var(--wt-theme-primary, #004b7c) !important;
  background-image: none !important;
  color: #ffffff !important;
  border: none !important;
}
.wt-btn-primary:hover,
.wt-primary-btn:hover,
.wt-btn--primary:hover {
  background: var(--wt-theme-primary-strong, #035a96) !important;
  background-image: none !important;
}

/* High importance actions stay strong */
.wt-btn-next {
  background: var(--wt-theme-primary, #004b7c);
  background-image: none !important;
  color: #ffffff !important;
  border: none;
  animation: none;
  width: auto;
  min-width: 0;
  display: inline-block;
}
.wt-btn-next.wt-btn-next--active {
  animation: none;
}
.wt-btn--tiny {
  font-size: 9px;
  padding: 3px 10px;
}

[data-wt-feedback-send] {
  width: 100%;
  max-width: none;
}

/* Settings pages keep buttons neutral */
body[data-page-id^="wt-settings"] .wt-btn-next,
body[data-page-id^="wt-settings"] .wt-btn-primary,
body[data-page-id^="wt-settings"] .wt-primary-btn,
body[data-page-id^="wt-settings"] .wt-btn--primary,
body[data-page-id^="wt-settings"] .wt-theme-btn--primary {
  background: #f3f4f6 !important;
  color: var(--wt-neutral-ink) !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 6px 14px rgba(15,23,42,0.08) !important;
}

/* Leave .wt-top-header (SOP header) alone so SOP preview/design is not affected */

/* Match page UI width to dashboard meta bar width */
.wt-page-frame {
  max-width: var(--wt-shell-width, 1620px) !important;
}

.wt-page-bg {
  max-width: var(--wt-shell-width, 1620px) !important;
}
