/* Current-source discovery: approved profile and header presentation. */
/* Preserve the original header layout; search must not move existing controls. */
.brand .client-brand-mark {
  display: inline-flex;
  align-items: center;
  gap: inherit;
  padding: 0;
  border: 0;
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  transform: scale(.8);
  transform-origin: left center;
}

@media (min-width: 1151px) {
  /* Leave the name at the central column's right edge, mirroring Overzicht. */
  .client-logout-form {
    position: absolute;
    top: 40px;
    right: 24px;
    transform: translateY(-50%);
  }
}

.client-search-header .header-inner {
  position: relative;
}

.client-header-search {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  /* Reserve the original navigation/account columns on either side. */
  width: min(400px, calc(100% - 1040px));
  min-width: 0;
}

.client-search-field { position: relative; }
.client-search-field input {
  width: 100%;
  padding: 10px 38px;
  background: #fafafa;
  font-size: 13px;
}
.client-search-field input::-webkit-search-cancel-button { display: none; }
.client-search-icon {
  position: absolute;
  left: 12px;
  top: 13px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}
.client-search-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.client-search-clear { position: absolute; top: 3px; right: 3px; }
.client-search-clear[hidden],
.client-search-results[hidden],
.client-search-empty[hidden] { display: none; }
.client-search-clear svg { width: 16px; height: 16px; }
.client-search-clear:hover { background: var(--surface); color: var(--ink); }

.client-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 120;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px #00000014;
}
.client-search-count { padding: 4px 8px 8px; color: var(--muted); font-size: 12px; }
.client-search-results ul { max-height: min(340px, 50dvh); margin: 0; padding: 0; list-style: none; overflow: auto; }
.client-search-option {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  min-height: 60px;
  padding: 10px 8px;
  border: 0;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.client-search-option:hover,
.client-search-option[aria-selected="true"] { background: var(--surface); }
.client-search-option[aria-selected="true"] { outline: 2px solid var(--ink); outline-offset: -2px; }
.client-search-result-title { font-size: 13px; font-weight: 600; }
.client-search-result-meta,
.client-search-empty { color: var(--muted); font-size: 12px; }
.client-search-empty { padding: 8px; }

.client-profile-back { display: inline-block; margin-bottom: 24px; color: var(--muted); font-size: 13px; text-decoration: none; }
.client-profile-back:hover { text-decoration: underline; }
.client-profile-heading { margin-bottom: 24px; }
.client-profile-customer-number { margin-top: 6px; color: var(--muted); font-size: 13px; }
.client-profile-status { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px; border-radius: 20px; background: #eef1f4; color: #58666f; font-size: 12px; font-weight: 500; }
.client-profile-status[data-state="review"] { background: #fff7e8; color: var(--amber); }
.client-profile-status[data-state="done"] { background: #edf5ef; color: var(--green); }
.client-profile-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin: 0 0 36px; padding: 24px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.client-profile-summary dt { margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.client-profile-summary dd { margin: 0; font-size: 28px; font-weight: 600; letter-spacing: -.6px; }
.client-profile-invoices { display: grid; gap: 14px; }
.client-profile-invoice { padding: 20px; }
.client-profile-invoice-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.client-profile-invoice h3 { min-width: 0; max-width: 100%; overflow-wrap: anywhere; margin: 0; font-size: 15px; font-weight: 600; }
.client-profile-invoice-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 18px 0 14px; }
.client-profile-invoice-facts dt { margin-bottom: 3px; color: var(--muted); font-size: 11px; }
.client-profile-invoice-facts dd { margin: 0; font-size: 12px; }
.client-profile-balance { font-weight: 600; }
.client-profile-invoice-summary { color: var(--muted); font-size: 13px; }
.client-profile-invoice .journey-services { margin-top: 16px; font-size: 12px; }
.client-profile-empty { font-size: 13px; }
.client-profile-empty p + p { margin-top: 8px; }
.source-history { margin-bottom: 24px; font-size: 12px; overflow-wrap: anywhere; }
.source-history > ol { margin: 16px 0 0; padding: 0; list-style: none; }
.source-history > ol > li + li { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.source-history p { margin-top: 8px; line-height: 1.5; }
.source-history dl { margin: 12px 0 0; }
.source-history dl > div + div { margin-top: 12px; }
.source-history dt { color: var(--muted); font-size: 11px; }
.source-history dd { margin: 4px 0 0; }
.source-history dd ol { margin: 0; padding: 0; list-style: none; }
.source-history dd li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.source-history dd li + li { margin-top: 8px; }
.source-service-amount { white-space: nowrap; }
.client-profile-timeline { margin: 0; padding: 20px 20px 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; list-style: none; }
.client-profile-timeline li { position: relative; display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 14px; padding-bottom: 24px; }
.client-profile-timeline li:not(:last-child)::before { content: ''; position: absolute; top: 18px; bottom: -4px; left: 8px; border-left: 1px solid #dedede; }
.client-profile-timeline li[data-phase="current"]::before,
.client-profile-timeline li[data-phase="upcoming"]::before { border-left-style: dashed; }
.client-profile-event-dot { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; width: 18px; height: 18px; margin-top: 2px; border: 1px solid #b5b5b5; border-radius: 50%; background: #fff; }
[data-phase="past"] .client-profile-event-dot { border: 0; background: #eef1f4; color: #58666f; }
.client-profile-event-dot svg { width: 16px; height: 16px; }
[data-phase="current"] .client-profile-event-dot { border-color: var(--ink); background: var(--ink); box-shadow: 0 0 0 4px #ededed; }
.client-profile-timeline h3 { margin: 3px 0; font-size: 13px; font-weight: 600; }
.client-profile-timeline p { color: var(--muted); font-size: 12px; }
.client-profile-timeline .client-profile-event-date { font-size: 11px; }
.client-profile-now { color: var(--ink); font-weight: 600; }
[data-phase="current"] h3 { font-size: 14px; }
.client-profile-timeline .client-profile-event-timing { margin-top: 4px; font-size: 11px; }

/* Approved shared profile layout; the two bodies start on the same grid row. */
.client-profile-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); grid-template-areas: "invoice-heading journey-heading" "guidance ." "invoices journey"; column-gap: 32px; align-items: start; }
.client-profile-invoices-heading { grid-area: invoice-heading; margin-bottom: 6px; }
.client-profile-journey-heading { grid-area: journey-heading; margin-bottom: 6px; }
.client-profile-journey { grid-area: journey; }
.client-profile-journey-panel { padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.client-profile-journey-panel[hidden] { display: none; }
.client-profile-journey-panel > .client-profile-timeline { min-width: 0; padding: 0; border: 0; border-radius: 0; }
.client-profile-journey-panel .client-profile-timeline li:last-child { padding-bottom: 0; }
.client-profile-layout-empty > h2 { margin-bottom: 16px; }
.client-profile-invoice-options { grid-area: invoices; min-width: 0; margin: 0; padding: 0; border: 0; }
.client-profile-invoice-guidance { grid-area: guidance; margin-bottom: 16px; color: var(--muted); font-size: 12px; }
.client-profile-invoice-options .client-profile-invoices { gap: 10px; }
.client-profile-invoice-card { padding: 12px; cursor: pointer; }
.client-profile-invoice-card:hover { border-color: #a5a5a5; }
.client-profile-invoice-card:has(input:checked) { border-color: var(--ink); }
.client-profile-invoice-choice:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 2px; }
.client-profile-invoice-card h3 { font-size: 14px; }
.client-profile-invoice-choice { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; cursor: pointer; }
.client-profile-selected { display: none; align-items: center; gap: 4px; color: var(--muted); font-size: 11px; font-weight: 500; }
.client-profile-selected svg { width: 12px; height: 12px; }
.client-profile-invoice-choice input:checked ~ .client-profile-selected { display: inline-flex; }
.client-profile-invoice-card .client-profile-invoice-heading { gap: 6px; }
.client-profile-invoice-card .client-profile-status { padding: 3px 8px; font-size: 11px; }
.client-profile-invoice-card .client-profile-invoice-facts { gap: 8px 12px; margin: 10px 0 8px; }
.client-profile-invoice-card .client-profile-invoice-summary { font-size: 12px; line-height: 1.5; }
.client-profile-review-statuses { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.client-profile-review-statuses .client-profile-status { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.client-profile-review-scope { margin-top: 8px; color: var(--muted); font-size: 11px; }
.client-profile-review-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; margin-top: 14px; }
.client-profile-review-actions .button { justify-content: center; width: auto; max-width: 100%; min-height: 40px; padding: 8px 14px; font-size: 12px; white-space: normal; }
.client-profile-review-actions svg { flex-shrink: 0; width: 16px; height: 16px; }
.client-profile-invoice-card .journey-services { margin-top: 10px; padding-top: 10px; cursor: auto; }
.client-profile-invoice-card .journey-services summary { font-size: 12px; }

@media (max-width: 800px) {
  .client-profile-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "invoice-heading" "guidance" "invoices" "journey-heading" "journey"; }
  .client-profile-journey-heading { margin-top: 32px; margin-bottom: 16px; }
}

@media (max-width: 600px) {
  .client-profile-summary { grid-template-columns: 1fr 1fr; gap: 20px; }
  .client-profile-summary dd { font-size: 25px; }
  .client-profile-invoice { padding: 16px; }
  .client-profile-invoice-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1240px) {
  .client-search-header .header-inner {
    min-height: 144px;
    padding-bottom: 64px;
  }
  .client-header-search {
    top: auto;
    bottom: 12px;
    transform: translateX(-50%);
    width: min(400px, calc(100% - 48px));
  }
}
@media (max-width: 600px) {
  .client-header-search { width: calc(100% - 32px); }
}


.client-profile-contact { margin-top: 8px; color: var(--muted); font-size: 12px; }
.client-profile-journey-panel h3 { margin: 0 0 10px; font-size: 14px; }
.client-profile-journey-panel p { margin-top: 6px; color: var(--muted); font-size: 12px; }
.client-search-pagination { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin: 8px; font-size: 12px; }
.client-search-pagination[hidden] { display: none; }
.customer-search-page-results { padding: 0; list-style: none; }
.customer-search-page-results a { display: flex; flex-direction: column; margin: 12px 0; padding: 14px; border: 1px solid var(--line); border-radius: 5px; text-decoration: none; }
.customer-search-page-results a:hover { background: var(--surface); }
.customer-search-page-results span { color: var(--muted); }
.client-profile-current-facts { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.client-profile-evidence-gap, .client-profile-upcoming { margin-top: 14px; color: var(--muted); font-size: 12px; }
.client-profile-frozen > summary { line-height: 1.5; }

.customer-pilot { margin-block: 1.25rem; }
.customer-pilot h2 { margin-block-start: 0; }

/* Persisted TEST customer and invoice identities contain full UUIDs. */
.client-profile-heading, .client-profile-customer-number, .client-profile-invoice-choice,
.client-search-option, .customer-search-page-results li { min-width: 0; overflow-wrap: anywhere; }

.client-profile .button { max-width: 100%; white-space: normal; }
.test-bookkeeping input, .test-bookkeeping select { width: 100%; max-width: 100%; min-width: 0; }
.test-bookkeeping { overflow-wrap: anywhere; }

/* The extra admin destination needs the same clear search row at medium widths. */
.admin-header .client-header-search { width: min(400px, calc(100% - 1240px)); }
@media (max-width: 1440px) {
  .client-search-header.admin-header .header-inner { min-height: 144px; padding-bottom: 64px; }
  .admin-header .client-header-search { top: auto; bottom: 12px; transform: translateX(-50%); width: min(400px, calc(100% - 48px)); }
}
@media (max-width: 600px) {
  .admin-header .client-header-search { width: calc(100% - 32px); }
}
