/* Persistent advisor ICP views. These styles deliberately reuse the
   established LeadGenerator palette and controls from style.css. */
.icp-onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  /* .auth-screen (style.css) centers its card with display:grid;
     place-items:center — fine for short login/signup content, but a
     centered grid/flex item that grows taller than its fixed, inset:0
     container gets its TOP clipped above the viewport with no way to
     scroll to it (a well-known centering+overflow interaction), which is
     exactly what happened once the ICP document preview/activation
     controls made this card taller than the screen. Overriding to a
     top-aligned flex layout on THIS overlay only (never touches the
     plain .auth-screen login/signup screen, which has no overlay class)
     makes the whole overlay itself the one scroll container — the card
     just flows downward and every control stays reachable, regardless of
     viewport height or preview length. */
  overflow-y: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.icp-onboarding-overlay .auth-card {
  /* Extra breathing room above/below now that the card is top-aligned
     rather than vertically centered — keeps it from sitting flush
     against the viewport edge on tall screens while still guaranteeing
     the bottom (activation buttons) is reachable by scrolling on short
     ones. .auth-screen's own 28px padding still applies on all sides.
     Width itself is set by .icp-onboarding-card below, not here — see
     its own comment for why a plain max-width override doesn't work. */
  margin: 20px 0 40px;
}

/* Onboarding specifically gets more desktop width than the plain
   login/signup card (still the same shared .auth-card, unchanged there)
   — enough for the heading to sit on 1-2 lines instead of 3, and for the
   document preview to breathe once it renders, without turning this into
   a marketing-width layout. .auth-card's own base rule sets width:
   min(420px, 100%) — an explicit `width`, which a mere `max-width`
   override on a lower-specificity selector can never widen past (the
   width already resolves below it regardless of any max-width). This
   selector matches the ".icp-onboarding-overlay .auth-card" specificity
   above (two classes) and comes later in the file, so its own `width`
   wins outright — same min(...,100%) responsive pattern as the base
   rule, so it also naturally collapses to fit narrow viewports with no
   extra media query needed. */
.icp-onboarding-overlay .icp-onboarding-card {
  width: min(780px, 100%);
}
.icp-onboarding-card h1 {
  font-size: 28px;
  letter-spacing: -1px;
}

.icp-onboarding-overlay textarea,
.icp-settings-panel textarea {
  width: 100%;
  min-height: 140px;
  margin: 0;
  resize: vertical;
}

.icp-input-block {
  margin: 18px 0;
}
.icp-input-block label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
}
.icp-input-block textarea:focus {
  border-color: var(--brand-primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-focus);
}

/* "eller" separator between the manual text path and the file-upload
   path — makes clear both belong to the same one-time step rather than
   reading as two unrelated form sections. */
.icp-or-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.icp-or-divider::before,
.icp-or-divider::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--line);
}

#icp-onboarding-status,
#icp-settings-status,
.icp-file-status {
  min-height: 1.2em;
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 12px;
}
#icp-onboarding-status.is-success,
#icp-settings-status.is-success {
  color: var(--success);
  font-weight: 650;
}

.icp-onboarding-file,
.icp-settings-file {
  margin: 4px 0 14px;
}

.icp-onboarding-file input,
.icp-settings-file input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.icp-file-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

/* A proper click target for the file input's <label> — same native
   "click to open the file dialog" behavior as before (still a <label
   for="...">, no new JS/drag-and-drop wired up), just visually upgraded
   from a small secondary button into a dedicated upload area befitting
   an important onboarding step. */
.icp-upload-area {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 18px;
  border: 1.5px dashed var(--brand-primary-border);
  border-radius: 10px;
  background: var(--brand-primary-soft);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background-color 160ms ease;
}
.icp-upload-area:hover {
  border-color: var(--brand-primary);
  background: var(--white);
}
.icp-upload-area:has(input:focus-visible),
.icp-onboarding-file input:focus-visible + .icp-upload-area {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}
.icp-upload-area-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--white);
  color: var(--brand-primary);
  font-size: 16px;
  font-weight: 700;
}
.icp-upload-area-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.icp-upload-area-text strong {
  font-size: 13px;
}
.icp-upload-area-text span {
  color: var(--muted);
  font-size: 12px;
}

/* Indeterminate loading state shown while a document/image is being
   read/extracted (the PDF pipeline can legitimately take ~20s) — a
   subtle animated bar plus a slowly rotating, honestly-qualitative status
   line (never a fake percentage; the frontend has no real progress
   signal from the backend to report). See onboarding.js's
   createLoadingRotation. */
.icp-loading {
  margin: 4px 0 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}
.icp-loading-bar {
  overflow: hidden;
  width: 100%;
  height: 4px;
  margin-bottom: 12px;
  border-radius: 4px;
  background: var(--brand-primary-border);
}
.icp-loading-bar span {
  display: block;
  width: 40%;
  height: 100%;
  border-radius: 4px;
  background: var(--brand-primary);
  animation: icp-loading-sweep 1.6s ease-in-out infinite;
}
@keyframes icp-loading-sweep {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(250%);
  }
}
.icp-loading-heading {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
}
.icp-loading-message {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
@media (prefers-reduced-motion: reduce) {
  .icp-loading-bar span {
    animation: none;
    width: 100%;
    opacity: 0.6;
  }
}

/* Document review/preview: framed as an explicit step ("the document was
   read, now confirm it looks right") rather than another form section
   silently appended below the upload control. */
.icp-preview-card {
  animation: icp-preview-reveal 220ms ease;
}
@keyframes icp-preview-reveal {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
/* No separate prefers-reduced-motion override needed here — style.css's
   own global `*, *::before, *::after { animation: none !important; }`
   rule already disables this (and every other) animation/transition in
   the app; without it the element still renders fully visible (its own
   non-animated base state has no opacity/transform set), so there is
   nothing further to fall back to. */
.icp-preview-heading {
  margin: 4px 0 4px;
  font-size: 18px;
}
.icp-preview-subheading {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}
.icp-preview-text-box {
  max-height: 260px;
  margin: 10px 0;
  padding: 12px 14px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}
.icp-preview-text-box .icp-settings-preview {
  margin: 0;
}

/* The advisor-facing reminder to keep LeadGenerator's Målgruppe aligned with
   the ICP + Value Proposition already used in Tables — shown on BOTH the
   first-time onboarding view and the settings view. */
.icp-important-notice {
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--ink, inherit);
  font-size: 13px;
  line-height: 1.5;
}

/* The normal analysis workspace keeps its existing structure and hidden
   ICP state hooks, while the lead-upload card uses the available width. */
.setup-grid:has(#icp-workspace-card[hidden]) {
  grid-template-columns: 1fr;
}

.icp-settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow-y: auto;
  background: var(--soft);
}

.icp-settings-panel {
  max-width: 720px;
  margin: 48px auto;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.icp-settings-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.icp-settings-header h1 {
  margin: 3px 0 0;
  font-size: 30px;
}

.icp-settings-back {
  flex-shrink: 0;
  margin-top: 6px;
}

@media (max-width: 640px) {
  .icp-settings-panel {
    min-height: 100%;
    margin: 0;
    padding: 24px 18px;
    border: 0;
    border-radius: 0;
  }

  .icp-settings-header {
    gap: 14px;
  }
}

/* Read-only "Analyseret med tidligere målgruppe" notice shown on a reopened session whose
   own ICP snapshot differs from the advisor's current profile ICP — see
   AnalysisState.sessionIcpVersionInfo / script.js's updateIcpVersionNotice.
   Purely informational plus one optional rerun CTA; it never implies the
   session itself changes. */
.icp-version-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 16px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.icp-version-notice p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 640px) {
  .icp-version-notice {
    flex-direction: column;
    align-items: stretch;
  }
}

/* "Aktiv målgruppe" read-only settings state (see onboarding.js's
   showSettingsView) — deliberately plain and distinct from the edit
   form's textarea/upload controls below it: a saved ICP is confirmed
   here, never re-presented as raw editable text by default. */
.icp-active-card {
  margin: 4px 0 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.icp-active-card .eyebrow {
  display: block;
  margin-bottom: 8px;
}

.icp-active-card .advanced-details {
  margin: 0;
}

.icp-settings-preview {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* Pending uploaded-document review, shown between "Upload fil" and the
   advisor's explicit "Brug denne målgruppe" confirmation — see
   onboarding.js's showDocumentPreview/activatePendingDocument. Reuses
   .icp-active-card/.advanced-details/.icp-settings-preview above; this
   only adds the two-button action row. */
.icp-document-preview {
  margin: 4px 0 14px;
}

.icp-document-preview-filename {
  margin: 0;
  font-weight: 600;
}

.icp-document-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

/* Organisation panel (organization.js) — plain rows reusing the existing
   settings-overlay chrome, no new visual language. */
.org-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.org-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.org-list-item:last-child {
  border-bottom: 0;
}

#org-invite-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
}

#org-invite-edit input {
  flex: 1 1 220px;
}

#org-invite-link-box {
  margin: 12px 0 0;
}

#org-invite-link-box input {
  width: 100%;
}
