.guided-tour-trigger,
.mobile-guided-tour-trigger {
  border: 0;
  color: #203248;
  background: transparent;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.guided-tour-trigger[hidden],
.mobile-guided-tour-trigger[hidden] { display: none !important; }

.guided-tour-trigger {
  display: inline-flex;
  align-items: center;
  width: 100%;
  min-height: 48px;
  gap: 10px;
  flex-shrink: 0;
  margin: 14px 0 12px;
  padding: 10px 12px;
  position: relative;
  border: 1px solid #cbdced;
  border-radius: 14px;
  color: #004fb0;
  background: #eaf2fc;
  box-shadow: none;
  overflow: hidden;
}

.guided-tour-trigger svg { flex-shrink: 0; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.guided-tour-trigger svg { color:#bd1769; }
.guided-tour-trigger:hover { background: #dceafa; color: #003d89; border-color:#a9c6e7; }
#portal .guided-tour-trigger + .side-help { margin-top: auto; }

@media (min-width: 1281px) {
  #portal[data-personal="true"] #sidebar .guided-tour-trigger { height:48px; padding:0; transition:width var(--sidebar-duration,220ms) cubic-bezier(.22,1,.36,1),background-color 150ms ease; }
  #portal[data-personal="true"] #sidebar .guided-tour-trigger svg { position:absolute;left:18px;top:13px;width:20px;height:20px;transition:left var(--sidebar-duration,220ms) cubic-bezier(.22,1,.36,1); }
  #portal[data-personal="true"] #sidebar .guided-tour-trigger .sidebar-label { position:absolute;left:52px;top:50%;translate:0 -50%;font-size:12px;font-weight:600;white-space:nowrap; }
  #portal[data-personal="true"][data-sidebar-collapsed="true"] #sidebar .guided-tour-trigger svg { left:13px; }
  #portal[data-personal="true"][data-sidebar-collapsed="true"] .guided-tour-trigger {
    align-self: center;
    justify-content: center;
    width: calc(100% - 10px);
    min-height: 48px;
    padding: 0;
  }
}
.guided-tour-trigger:focus-visible,
.mobile-guided-tour-trigger:focus-visible { outline: 2px solid #a92765; outline-offset: 3px; }
@media(prefers-reduced-motion:reduce){#portal #sidebar .guided-tour-trigger,#portal #sidebar .guided-tour-trigger svg{transition:none}}

.mobile-guided-tour-trigger { display: none; }

.guided-tour {
  --tour-accent: #ec3e79;
  --tour-soft: #fff0f5;
  position: fixed;
  z-index: 15000;
  inset: 0;
  overflow: visible;
  color: #203248;
  font-family: Inter, system-ui, sans-serif;
  isolation: isolate;
}

.guided-tour-backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
  transition: none;
  touch-action: none;
}

.guided-tour.is-unanchored .guided-tour-backdrop { background: rgba(15, 26, 42, .72); }

.guided-tour-spotlight {
  position: fixed;
  z-index: 1;
  box-sizing: border-box;
  border: 3px solid var(--tour-accent);
  box-shadow: 0 0 0 9999px rgba(15, 26, 42, .72), 0 0 0 7px color-mix(in srgb, var(--tour-accent) 28%, transparent), inset 0 0 0 1px #fff;
  pointer-events: none;
  transition: top .2s ease, left .2s ease, width .2s ease, height .2s ease;
}

.guided-tour-spotlight[hidden] { display: none !important; }

.guided-tour-card {
  position: fixed;
  z-index: 2;
  box-sizing: border-box;
  width: min(410px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, .8);
  border-top: 5px solid var(--tour-accent);
  border-radius: 20px;
  background: #fffefa;
  box-shadow: 0 24px 72px rgba(5, 18, 36, .27), 0 4px 14px rgba(5, 18, 36, .12);
  outline: none;
  transition: none;
  animation: guided-tour-enter .2s cubic-bezier(.2, .8, .2, 1) both;
}

.guided-tour-card:focus-visible { outline: 3px solid #f1c64b; outline-offset: 3px; }
.guided-tour-version { display: block; margin-bottom: 12px; color: #657487; font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.guided-tour-body { display: grid; grid-template-columns: minmax(0, 1fr) 88px; align-items: center; gap: 12px; margin: 14px 0 18px; }
.guided-tour-figure { width: 88px; height: 110px; object-fit: contain; align-self: end; }
.guided-tour-figure[hidden], .guided-tour-close-flow[hidden] { display: none !important; }
.guided-tour-close-flow { display: flex; justify-content: space-between; gap: 5px; margin: 0 0 16px; padding: 0; list-style: none; color: #68778a; font-size: 10px; }
.guided-tour-close-flow li { padding: 6px 8px; border-radius: 7px; background: #f1f3f5; }
.guided-tour-close-flow .is-active { color: var(--tour-accent); background: var(--tour-soft); font-weight: 800; box-shadow: inset 0 0 0 1px var(--tour-accent); }

.guided-tour-head { display: grid; grid-template-columns: 38px minmax(0, 1fr) 32px; align-items: start; gap: 11px; }
.guided-tour-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  color: var(--tour-accent);
  background: var(--tour-soft);
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 700;
}
.guided-tour-eyebrow { display: block; margin: 1px 0 4px; color: var(--tour-accent); font-size: 9px; font-weight: 800; letter-spacing: .06em; }
.guided-tour-head h2 { margin: 0; color: #1e304a; font-family: Fraunces, Georgia, serif; font-size: 22px; font-weight: 600; line-height: 1.2; }
.guided-tour-close { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 10px; color: #667489; background: #f1f3f5; font-size: 23px; line-height: 1; cursor: pointer; }
.guided-tour-copy { margin: 0; color: #44546a; font-size: 13px; line-height: 1.65; }
.guided-tour-chapters { display: flex; justify-content: space-between; gap: 8px; margin: 0 0 20px; padding: 0; list-style: none; }
.guided-tour-chapters li { display: flex; align-items: center; gap: 6px; color: #8993a1; font-size: 10px; }
.guided-tour-chapters li > span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #eef0f3; font-weight: 800; }
.guided-tour-chapters li > b { display: none; }
.guided-tour-chapters .is-active { color: var(--tour-accent); }
.guided-tour-chapters .is-active > span { color: white; background: var(--tour-accent); }
.guided-tour-chapters .is-active > b { display: block; max-width: 105px; }
.guided-tour-chapters .is-complete > span { color: #407961; background: #edf7f1; }
.guided-tour-meter { height: 4px; overflow: hidden; border-radius: 4px; background: #eef0f3; }
.guided-tour-meter i { display: block; height: 100%; background: var(--tour-accent); transition: width .2s ease; }
.guided-tour-footer { display: flex; flex-direction: column; align-items: stretch; gap: 12px; padding-top: 15px; border-top: 1px solid #e9edf1; }
.guided-tour-progress { flex: 0 0 auto; color: #728092; font-size: 11px; font-weight: 700; white-space: nowrap; }
.guided-tour-actions { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: 8px; }
.guided-tour-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; min-height: 44px; padding: 0 12px; border: 1px solid transparent; border-radius: 999px; color: #536276; background: #fff; font: inherit; font-size: 11px; font-weight: 750; cursor: pointer; white-space: nowrap; transition: background .15s ease, box-shadow .15s ease; }
.guided-tour-actions button svg { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.guided-tour-actions .guided-tour-skip { justify-content: flex-start; padding-inline: 2px 6px; color: #6c7b8e; background: transparent; }
.guided-tour-actions .guided-tour-skip:hover { color: #203248; background: #f1f3f5; }
.guided-tour-actions .guided-tour-back { color: #203248; border-color: color-mix(in srgb, var(--tour-accent) 20%, #e1e6eb); background: var(--tour-soft); }
.guided-tour-actions .guided-tour-back:hover:not(:disabled) { border-color: var(--tour-accent); }
.guided-tour-actions button:disabled { opacity: .38; cursor: not-allowed; box-shadow: none; }
.guided-tour-actions .guided-tour-next { justify-content: space-between; gap: 8px; border-color: #203248; color: #fff; background: linear-gradient(135deg, #294467, #172746); box-shadow: 0 5px 12px rgba(23, 39, 70, .2); }
.guided-tour-actions .guided-tour-next:hover { background: #294467; box-shadow: 0 6px 16px rgba(23, 39, 70, .3); }
.guided-tour-next-bubble { display: grid; place-items: center; width: 24px; height: 24px; flex-shrink: 0; border: 1px solid #dce5ef; border-radius: 50%; color: #245f99; background: #fff; box-shadow: 0 1px 3px rgba(23, 39, 70, .12); }
.guided-tour-actions button:focus-visible,
.guided-tour-close:focus-visible { outline: 2px solid #245f99; outline-offset: 2px; }

@keyframes guided-tour-enter {
  from { opacity: 0; transform: translateY(7px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (min-width: 901px) and (max-width: 1280px) {
  .guided-tour-card { padding: 16px; }
  .guided-tour-chapters .is-active > b { display: none; }
  .guided-tour-head { grid-template-columns: 30px minmax(0, 1fr) 28px; gap: 8px; }
  .guided-tour-mark { width: 30px; height: 30px; }
  .guided-tour-close { width: 28px; height: 28px; }
  .guided-tour-head h2 { font-size: 19px; }
  .guided-tour-body { grid-template-columns: minmax(0, 1fr) 60px; gap: 8px; }
  .guided-tour-figure { width: 60px; height: 90px; }
  .guided-tour-copy { font-size: 12px; line-height: 1.55; }
  .guided-tour-footer { flex-direction: column; align-items: stretch; gap: 10px; }
  .guided-tour-actions button { flex: 1; min-width: 0; padding-inline: 6px; }
  .guided-tour-actions { grid-template-columns: 1fr 1fr; gap: 6px; }
  .guided-tour-actions .guided-tour-skip { grid-column: 1 / -1; justify-content: center; min-height: 28px; }
  .guided-tour-actions .guided-tour-next { gap: 4px; font-size: 10px; }
  .guided-tour-next-bubble { width: 20px; height: 20px; }
  .guided-tour-close-flow { gap: 3px; font-size: 9px; }
  .guided-tour-close-flow li { padding-inline: 5px; }
}

@media (max-width: 900px) {
  /* Keep all quick actions visible while the guide card sits right beneath them. */
  #portal[data-guided-tour="mobile"] .mobile-portal-sheet::after { content: ''; display: block; order: 999; height: 100dvh; flex: 0 0 100dvh; pointer-events: none; }
  #portal:not(.admin-wide) .mobile-guided-tour-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 11px;
    border: 1px solid #e4e9ee;
    border-radius: 11px;
    color: #34516d;
    background: rgba(255, 255, 255, .88);
    box-shadow: 0 3px 10px rgba(25, 46, 67, .05);
    white-space: nowrap;
  }
  .mobile-guided-tour-trigger svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .mobile-guided-tour-trigger span { font-size: 10px; }
  .mobile-sheet-heading { align-items: center; }
  .guided-tour-card { width: min(420px, calc(100vw - 24px)); max-height: min(70dvh, calc(100dvh - 24px)); padding: 14px; border-radius: 18px; }
  .guided-tour-head { grid-template-columns: minmax(0, 1fr) 32px; gap: 8px; align-items: center; }
  .guided-tour-mark, .guided-tour-eyebrow { display: none; }
  .guided-tour-head h2 { font-size: 20px; }
  .guided-tour-version { margin-bottom: 8px; font-size: 9px; }
  .guided-tour-chapters { display: none; }
  .guided-tour-body { grid-template-columns: minmax(0, 1fr); margin: 10px 0 12px; }
  .guided-tour-copy { margin: 0; font-size: 12px; }
  .guided-tour-close-flow { margin-bottom: 12px; }
  .guided-tour-footer { align-items: stretch; flex-direction: column; gap: 6px; padding-top: 9px; border-top: 0; }
  .guided-tour-actions { width: 100%; }
  .guided-tour-actions button { flex: 0 0 auto; min-height: 42px; padding-inline: 10px; }
}

@media (max-width: 380px) {
  .guided-tour-head h2 { font-size: 18px; }
  .guided-tour-actions { gap: 5px; }
  .guided-tour-actions button { padding-inline: 7px; font-size: 10px; gap: 4px; }
  .guided-tour-actions .guided-tour-skip { padding-inline: 0 3px; }
  .guided-tour-actions .guided-tour-skip svg { display: none; }
  .guided-tour-next-bubble { width: 20px; height: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .guided-tour-card { animation: none; }
  .guided-tour-spotlight { transition: none; }
}
