/* Decision Companion Tutorial & Offline Help Suite */

/* --- Focus & Accessibility --- */
:focus-visible { outline: 3px solid var(--accent, #0284c7); outline-offset: 2px; }

/* --- Topbar Header Help Button (Standalone fallback) --- */
.header-help-btn {
  flex: none;
  background: transparent;
  border: 1px solid var(--header-ink, #ffffff);
  border-color: color-mix(in srgb, var(--header-ink, #ffffff) 45%, transparent);
  border-radius: 999px;
  padding: 8px 14px;
  min-height: 48px;
  min-width: 48px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  color: var(--header-ink, #ffffff);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.header-help-btn:hover {
  border-color: var(--header-ink, #ffffff);
  color: var(--header-ink, #ffffff);
}
.header-help-btn:focus-visible {
  outline: 3px solid var(--header-marker, #fbbf24);
  outline-offset: 2px;
}

/* --- Screen-level "How to use this page?" links --- */
.screen-guide-link, .picker-help-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: underline;
  min-height: 48px;
  padding: 8px 4px;
  margin: 4px 0 10px;
  cursor: pointer;
  background: none;
  border: none;
}
.screen-guide-link:hover, .picker-help-link:hover {
  color: var(--accent-press, #0369a1);
}

/* --- Field-level Help --- */
.field-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 48px;
  min-height: 48px;
  margin-inline-start: 6px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--sunk);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  vertical-align: middle;
}
.field-help-btn:hover {
  background: var(--card);
  border-color: var(--accent);
  color: var(--accent);
}
.field-help-text {
  margin: 4px 0 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm, 8px);
  background: var(--warn-wash);
  border: 1px solid var(--warn-line);
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.4;
}

/* --- Contextual Persona Variation Cue --- */
.persona-tool-cue {
  margin: 6px 0 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm, 8px);
  background: var(--gold-wash, #fef9c3);
  border: 1px solid var(--warn-line, #fde047);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
}

/* --- Welcome Panel --- */
.dc-welcome-card {
  margin: 12px 0 18px;
  padding: var(--space-4, 16px);
  background: var(--card);
  border: 2px solid var(--accent);
  border-radius: var(--radius, 14px);
  box-shadow: var(--shadow-card);
}
.dc-welcome-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
}
.dc-welcome-body {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.45;
}
.dc-welcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.dc-welcome-actions button {
  min-height: 48px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 14px;
  border-radius: var(--radius-sm, 10px);
  cursor: pointer;
}
.dc-welcome-actions .btn-show {
  flex: 1 1 140px;
  background: var(--action);
  color: var(--action-ink);
  border: none;
}
.dc-welcome-actions .btn-start {
  flex: 1 1 120px;
  background: var(--sunk);
  color: var(--ink);
  border: 1px solid var(--line);
}
.dc-welcome-actions .btn-skip {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: var(--muted);
  text-decoration: underline;
}

/* --- Pointer Tour Popover & Overlay --- */
.dc-tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  pointer-events: none;
}
.dc-tour-popover {
  position: absolute;
  z-index: 950;
  width: calc(100% - 24px);
  max-width: 360px;
  background: var(--card);
  border: 2px solid var(--accent);
  border-radius: var(--radius, 14px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  padding: 16px;
  color: var(--ink);
  pointer-events: auto;
  box-sizing: border-box;
}
.dc-tour-popover.dc-bottom-sheet {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  max-width: 440px;
  margin: 0 auto;
  z-index: 960;
}
.dc-tour-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-wash);
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.dc-tour-body {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.45;
  margin: 0 0 14px;
  color: var(--ink);
}
.dc-tour-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.dc-tour-actions button {
  min-height: 48px;
  min-width: 48px;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-sm, 10px);
  cursor: pointer;
  padding: 10px 16px;
}
.dc-tour-actions .dc-btn-next {
  background: var(--action);
  color: var(--action-ink);
  border: none;
  flex: 1 1 auto;
}
.dc-tour-actions .dc-btn-skip {
  background: none;
  border: none;
  color: var(--muted);
  text-decoration: underline;
  flex: 0 0 auto;
}

/* Spotlight pulse on anchored element */
.dc-spotlight {
  outline: 3px solid var(--accent) !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 4px var(--accent-wash) !important;
  border-radius: var(--radius-sm, 8px);
}

/* --- Contextual Tip Card --- */
.dc-tip-card {
  margin: 10px 0 16px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--accent);
  border-left: 5px solid var(--accent);
  border-radius: var(--radius-sm, 10px);
  box-shadow: var(--shadow-card);
}
.dc-tip-title {
  font-size: 14px;
  font-weight: 800;
  margin: 0 0 4px;
  color: var(--ink);
}
.dc-tip-body {
  font-size: 13.5px;
  line-height: 1.45;
  margin: 0 0 12px;
  color: var(--muted);
}
.dc-tip-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dc-tip-actions button {
  min-height: 48px;
  min-width: 48px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--radius-sm, 8px);
  cursor: pointer;
}
.dc-tip-ok {
  background: var(--action);
  color: var(--action-ink);
  border: none;
}
.dc-tip-skip {
  background: none;
  border: none;
  color: var(--muted);
  text-decoration: underline;
}

/* --- Help Hub View / Modal --- */
.dc-help-hub {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  min-height: 100vh;
  z-index: 1000;
  overflow-y: auto;
  background: var(--bg);
  color: var(--ink);
  padding: 12px 16px 80px;
  box-sizing: border-box;
}
.dc-help-shell {
  max-width: 600px;
  margin: 0 auto;
}
.dc-help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--line);
  margin-bottom: 16px;
}
.dc-help-header h2 {
  font-size: 20px;
  margin: 0;
  font-weight: 800;
}
.dc-help-close {
  min-height: 48px;
  min-width: 48px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 14px;
  background: var(--sunk);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 10px);
  cursor: pointer;
}

/* --- Section: Who is this for? --- */
.dc-help-who-intro {
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--muted);
  margin: 0 0 14px;
}
.dc-help-groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}
.dc-group-card {
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 10px);
  box-shadow: var(--shadow-card);
}
.dc-group-card-title {
  font-size: 15px;
  font-weight: 800;
  margin: 0 0 4px;
  color: var(--ink);
}
.dc-group-card-copy {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.4;
  margin: 0 0 8px;
}
.dc-group-card-examples {
  font-size: 12px;
  color: var(--faint);
  margin: 0 0 10px;
  line-height: 1.35;
}
.dc-group-card-btn {
  min-height: 48px;
  min-width: 48px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  background: var(--sunk);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 8px);
  cursor: pointer;
  width: 100%;
}
.dc-group-card-btn:hover {
  border-color: var(--accent);
}

/* --- Disclosure Accordion Sections --- */
.dc-help-section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius, 14px);
  margin-bottom: 12px;
  overflow: hidden;
}
.dc-help-section > summary {
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  background: var(--card);
}
.dc-help-section > summary::-webkit-details-marker { display: none; }
.dc-help-section > summary::after {
  content: "▾";
  font-size: 18px;
  color: var(--muted);
  transition: transform 120ms ease-out;
}
.dc-help-section[open] > summary::after {
  transform: rotate(-180deg);
}
.dc-help-section-content {
  padding: 12px 16px 18px;
  border-top: 1px solid var(--line-soft, var(--line));
}

/* --- Start here (Tour replay & tip reset) --- */
.dc-start-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dc-start-actions button {
  min-height: 48px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-sm, 10px);
  cursor: pointer;
  text-align: start;
}
.dc-btn-replay {
  background: var(--action);
  color: var(--action-ink);
  border: none;
}
.dc-btn-reset-tips {
  background: var(--sunk);
  color: var(--ink);
  border: 1px solid var(--line);
}
.dc-start-note {
  font-size: 12.5px;
  color: var(--muted);
  margin: 4px 0 0;
}

/* --- Screen Guides List --- */
.dc-screen-guides {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dc-screen-card {
  padding: 12px 14px;
  background: var(--sunk);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 8px);
}
.dc-screen-card h4 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}
.dc-screen-card-guide {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.4;
}
.dc-screen-card-tip {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
  border-top: 1px dashed var(--line);
  padding-top: 6px;
}

/* --- Decision Tools List --- */
.dc-tools-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dc-tool-guide-card {
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 10px);
  box-shadow: var(--shadow-card);
}
.dc-tool-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.dc-tool-card-title {
  font-size: 15.5px;
  font-weight: 800;
  margin: 0;
  color: var(--ink);
}
.dc-badge-live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--profit-wash, #dcfce7);
  color: var(--profit, #16a34a);
  border: 1px solid color-mix(in srgb, var(--profit, #16a34a) 40%, transparent);
}
.dc-badge-live::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--profit, #16a34a);
}
.dc-badge-planned {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--sunk);
  color: var(--muted);
  border: 1px solid var(--line);
}
.dc-badge-planned::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.5;
}
.dc-tool-purpose {
  font-size: 13.5px;
  color: var(--ink);
  line-height: 1.4;
  margin: 0 0 6px;
}
.dc-tool-need {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.35;
  margin: 0 0 10px;
}
.dc-tool-planned-note {
  font-size: 13px;
  font-weight: 700;
  color: var(--warn, #d97706);
  background: var(--warn-wash);
  padding: 6px 10px;
  border-radius: var(--radius-sm, 6px);
  margin: 0 0 8px;
}
.dc-tool-reminder-note {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--loss, #dc2626);
  background: var(--loss-wash, #fee2e2);
  padding: 6px 10px;
  border-radius: var(--radius-sm, 6px);
  margin: 0 0 8px;
}
.dc-tool-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.dc-tool-actions button {
  min-height: 48px;
  min-width: 48px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--radius-sm, 8px);
  cursor: pointer;
}
.dc-btn-open-tool {
  background: var(--action);
  color: var(--action-ink);
  border: none;
}
.dc-btn-view-guide {
  background: var(--sunk);
  color: var(--ink);
  border: 1px solid var(--line);
}

/* --- Dedicated Single Tool Guide View --- */
.dc-tool-guide-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  min-height: 100vh;
  z-index: 1050;
  overflow-y: auto;
  background: var(--bg);
  color: var(--ink);
  padding: 14px 16px 80px;
  box-sizing: border-box;
}
.dc-tool-guide-shell {
  max-width: 560px;
  margin: 0 auto;
  padding: var(--space-4, 16px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius, 14px);
  box-shadow: var(--shadow-card);
}
.dc-tool-guide-shell h2 {
  font-size: 20px;
  font-weight: 800;
  margin: 8px 0 12px;
}
.dc-tool-guide-section {
  margin: 12px 0;
}
.dc-tool-guide-section h4 {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--faint);
  margin: 0 0 4px;
}
.dc-tool-guide-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}
.dc-tool-guide-actions button {
  min-height: 48px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-sm, 10px);
  cursor: pointer;
  width: 100%;
}

/* --- Privacy section --- */
.dc-privacy-content p {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
  margin: 0 0 10px;
}
.dc-privacy-content strong {
  color: var(--ink);
}

/* --- 320px narrow phone responsiveness --- */
@media (max-width: 340px) {
  .dc-tour-popover {
    width: 100%;
    left: 0 !important;
    right: 0 !important;
    padding: 12px;
  }
  .dc-help-header h2 {
    font-size: 17px;
  }
  .dc-welcome-actions {
    flex-direction: column;
  }
  .dc-welcome-actions button {
    width: 100%;
  }
}

/* --- Reduced motion support --- */
@media (prefers-reduced-motion: reduce) {
  .dc-tour-popover,
  .dc-help-hub,
  .dc-tool-guide-modal,
  .dc-welcome-card {
    animation: none !important;
    transition: none !important;
  }
}
html.no-anim .dc-tour-popover,
html.no-anim .dc-help-hub,
html.no-anim .dc-tool-guide-modal,
html.no-anim .dc-welcome-card {
  animation: none !important;
  transition: none !important;
}

.dc-tour-spacer { width: 1px; pointer-events: none; }
