/* L07: responsive navigation, startup and a viewport-contained review. */
:root { --motion-fast: 120ms; --motion-normal: 240ms; --motion-ease: cubic-bezier(.2,.7,.2,1); }
button, input, select, textarea, summary { scroll-margin-block: 18px; }
button:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.client-tools > *, .onboarding-steps > li > *, .qcm-options > * { min-width: 0; }
.onboarding-card { margin-bottom: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.onboarding-card summary, .progress-disclosure summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.onboarding-steps { display: grid; gap: 12px; padding-left: 20px; }
.onboarding-steps li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.onboarding-steps li > span { flex: 1 1 180px; }
.progress-disclosure { margin-top: 24px; }
.training-intro { grid-template-columns: minmax(0,1fr); gap: 16px; margin-bottom: 18px; padding-bottom: 18px; }
.training-intro h2 { font-size: clamp(1.8rem,4vw,2.8rem); }
.daily-intro { gap: 16px; }
.modal { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow-y: auto; overscroll-behavior: contain; }
.modal form > .button[type=submit] { position: sticky; bottom: 0; z-index: 1; }
.memory-card-inner { transition: transform var(--motion-normal) var(--motion-ease); }
.memory-name { overflow-wrap: anywhere; }
.consultation-note { margin: 4px; color: var(--muted); font-size: .75rem; }
.review-active .app-header, .review-active #demoBanner, .review-active #installBanner, .review-active #onboardingPanel, .review-active .bottom-nav { display: none !important; }
.review-active .workspace { padding: 12px; height: 100vh; height: 100dvh; overflow: hidden; }
.review-active #trainingView, .review-active .training-session { height: 100%; }
.review-active .training-session { display: flex; flex-direction: column; max-width: 720px; padding-bottom: env(safe-area-inset-bottom); }
.review-active .session-top { flex: none; min-height: 44px; margin-bottom: 8px; }
.review-active .session-top button { min-height: 44px; }
.review-active #trainingCardStage { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.review-active .memory-card { flex: 1; height: auto; min-height: 0; max-height: 620px; }
.review-active .memory-face { padding: 16px; border-radius: 20px; }
.review-active .memory-face.front { padding-bottom: 42px; }
.review-active .memory-face .memory-photo { min-height: 0; }
.review-active .memory-face .memory-name { font-size: clamp(1.2rem,3vw,2rem); flex: none; max-height: 30%; overflow-y: auto; margin: 6px 0; }
.review-active .memory-details { min-height: 0; overflow-y: auto; overscroll-behavior: contain; max-height: 70%; }
.review-active .answer-actions, .review-active .simple-card-actions { flex: none; margin: 0 auto; min-height: 48px; width: min(560px,100%); }
.review-active .answer-actions .button { min-height: 48px; }
.review-active .swipe-hint { display: none; }
.review-active .qcm-stage { flex: 1; min-height: 0; display: grid; grid-template-rows: minmax(60px,1fr) auto auto auto auto; gap: 6px; }
.review-active .qcm-photo { height: 100%; width: min(250px,100%); min-height: 0; aspect-ratio: auto; margin: 0 auto; border-radius: 18px; }
.review-active .qcm-photo img { object-fit: contain; }
.review-active .qcm-question, .review-active .qcm-feedback, .review-active .qcm-next { margin: 0; }
.review-active .qcm-options { gap: 6px; }
.review-active .qcm-option { min-height: 44px; max-height: 88px; overflow-y: auto; overflow-wrap: anywhere; padding: 8px; }
.review-active .training-save-state { flex: none; max-height: 110px; overflow-y: auto; }
.review-active .training-save-state p { margin: 0 0 4px; }
@media (max-width: 900px) {
  .button, .text-button, .quiet-action, .view-switch button, .team-tabs button { min-height: 44px; }
  .workspace { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
  .client-tools { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 8px; }
  .client-tools .search-box { grid-column: 1 / -1; }
  .client-tools select { width: 100%; max-width: 100%; }
  .daily-intro { padding: 16px; }
  .daily-intro h2 { font-size: 1.5rem; }
  .daily-intro > div > p:not(.eyebrow) { margin-block: 6px; font-size: .8rem; }
  .daily-actions { flex-wrap: wrap; }
  .app-header { margin-bottom: 16px; flex-wrap: wrap; }
  .app-header > div { min-width: 0; max-width: 100%; }
  .app-header h1 { overflow-wrap: anywhere; }
  .header-account-actions { flex-wrap: wrap; }
  .form-grid.two, .team-filters { grid-template-columns: minmax(0,1fr); }
  .modal { padding: 18px; }
  .detail-hero { gap: 12px; }
  .detail-actions .button { flex: 1 1 auto; }
  .review-active .workspace { margin: 0; padding: max(8px,env(safe-area-inset-top)) 10px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
  .memory-card-inner { transition: none; transform: none !important; }
  .memory-face.back { transform: none; }
  .memory-card .memory-face[aria-hidden=true] { visibility: hidden; }
}

.review-active #connectionBanner { position: fixed; z-index: 100; inset: 0 0 auto; max-height: 120px; overflow: auto; }
@media (max-height: 500px) and (min-width: 480px) {
  .review-active .answer-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .review-active .qcm-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .review-active .qcm-stage { grid-template-rows: minmax(24px, 1fr) auto auto auto auto; gap: 4px; }
  .review-active .qcm-question { font-size: 1rem; }
}
.person-tools { margin-block: 18px; padding: 14px; border: 1px solid var(--line); border-radius: 15px; }
.person-tools summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.collection-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-block: 8px; }
.collection-row > span, .collection-row > strong { flex: 1 1 180px; overflow-wrap: anywhere; }
.import-row { display: flex; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.import-row input { flex: none; width: 22px; height: 22px; }
.import-row span, .import-row small { display: block; overflow-wrap: anywhere; }
.import-sample { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 120px; overflow: auto; font-size: .8rem; }
.private-cue-row { border-bottom: 1px solid var(--line); padding-block: 10px; overflow-wrap: anywhere; }
.pilot-photo { width: min(220px,100%); max-height: 240px; object-fit: contain; display: block; margin: auto; border-radius: 16px; }
#pilotList { display: grid; gap: 10px; margin-top: 12px; }
.recall-stage, .workshop-stage { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.review-active .recall-stage .qcm-photo, .review-active .workshop-stage .qcm-photo { flex: 1; height: auto; min-height: 40px; max-height: 480px; }
.recall-stage .qcm-question { margin: 0; font-size: 1.2rem; }
.recall-form label, .workshop-form label { display: grid; gap: 5px; }
.recall-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.recall-actions .text-button { grid-column: 1 / -1; }
.recall-stage p.form-message, .recall-hint { margin: 0; max-height: 80px; overflow-y: auto; overflow-wrap: anywhere; }
.recall-stage button, .workshop-stage button { min-height: 44px; }
.workshop-stage .memory-name, .workshop-stage .eyebrow { margin: 0; }
.workshop-guide { margin: 0; max-height: 100px; overflow-y: auto; font-size: .85rem; }
.workshop-form { display: grid; gap: 6px; }
.review-active .workshop-stage textarea { min-height: 60px; max-height: 100px; }
@media (max-width: 600px) { .choice-cards { grid-template-columns: 1fr 1fr; } .choice-cards strong, .choice-cards small { overflow-wrap: anywhere; } }
@media (max-height: 500px) and (min-width: 480px) { .recall-stage, .workshop-stage { overflow-y: auto; } }

/* L12: feedback is decorative; responses and progression remain server-driven. */
.button, .text-button { transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease; }
.button:active:not(:disabled) { filter: brightness(.94); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--accent, #c5a878); outline-offset: 3px; }
button[aria-busy="true"] { cursor: progress; }
button:disabled { cursor: default; }
.recall-stage, .workshop-stage, .memory-card, .qcm-stage { animation: review-arrive 150ms ease-out both; }
@keyframes review-arrive { from { opacity: .65; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.compliance-request { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-block: 10px; overflow-wrap: anywhere; }
.compliance-request button { margin: 4px; }
.compliance-actions { flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; } }
.backup-row > *, .supervision-row > * { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .backup-row, .supervision-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}
.organization-picker { display: grid; gap: 8px; width: 100%; min-width: 0; margin-block: 10px; }
.organization-picker[hidden] { display: none; }
.organization-picker label { display: grid; gap: 6px; font-size: .8rem; }
.organization-picker select { width: 100%; min-width: 0; }
.organization-picker .button { white-space: normal; min-height: 44px; }
.organization-picker .form-message:empty { display: none; }

/* Compact directory controls share one row when space permits. */
.client-tools { display: flex; align-items: center; gap: 8px; margin-block: 16px 10px; }
.client-tools .search-box { flex: 1.6 1 180px; min-width: 160px; }
.client-tools > select { flex: 1 1 110px; min-width: 0; max-width: 165px; width: 100%; }
.client-tools .view-switch { flex: none; }
.client-tools .archive-filter { display: flex; flex: 0 1 126px; min-width: 100px; align-items: center; gap: 4px; }
.archive-filter .material-symbols-rounded { font-size: 18px; color: var(--muted); }
.client-tools .archive-filter select { min-width: 0; width: 100%; font-size: .79rem; }
.client-pagination { justify-content: flex-end; margin-block: 8px 12px; font-size: .8rem; }
.member-table { width: 100%; border-collapse: collapse; table-layout: fixed; border: 1px solid var(--line); background: var(--surface); font-size: .82rem; }
.member-table th, .member-table td { padding: 12px 10px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.member-table thead { background: var(--surface-2); color: var(--muted); font-size: .74rem; }
.member-table thead th { font-weight: 600; }
.member-table thead th:nth-child(1) { width: 19%; }
.member-table thead th:nth-child(2) { width: 24%; }
.member-table thead th:nth-child(3) { width: 14%; }
.member-table thead th:nth-child(4) { width: 12%; }
.member-table thead th:nth-child(6) { width: 94px; }
.member-table tbody tr:hover { background: var(--surface-2); }
.member-table tbody tr.inactive { color: var(--muted); }
.member-table .button { min-height: 36px; padding: 6px 10px; font-size: .76rem; }
.member-identity { display: flex; align-items: center; gap: 9px; min-width: 0; }
.member-name { min-width: 0; overflow-wrap: anywhere; }
.member-avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; border-radius: 50%; font-size: .72rem; font-weight: 700; line-height: 1; letter-spacing: .02em; }
.member-avatar-0 { background: #dbeafe; color: #1e3a8a; }
.member-avatar-1 { background: #ede9fe; color: #4c1d95; }
.member-avatar-2 { background: #d1fae5; color: #065f46; }
.member-avatar-3 { background: #ffedd5; color: #7c2d12; }
.member-avatar-4 { background: #fce7f3; color: #831843; }
.member-avatar-5 { background: #cffafe; color: #164e63; }
.member-status { display: inline-flex; gap: 5px; align-items: center; }
.member-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); flex: none; }
.member-status.active::before { background: var(--success); }
@media (max-width: 1100px) and (min-width: 901px) {
  .client-tools { flex-wrap: wrap; }
  .client-tools .search-box { flex-basis: 100%; }
}
@media (max-width: 900px) {
  .client-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .client-tools .search-box { grid-column: 1 / -1; min-width: 0; }
  .client-tools > select, .client-tools .archive-filter { max-width: none; min-width: 0; width: 100%; }
  .client-tools .view-switch { width: fit-content; justify-self: end; }
  .member-table .button { min-height: 44px; }
}
@media (max-width: 700px) {
  #teamView .section-heading { flex-wrap: wrap; }
  #teamView .section-heading > * { min-width: 0; max-width: 100%; }
  .member-table, .member-table tbody { display: block; width: 100%; }
  .member-table thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); }
  .member-table tbody tr { display: block; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .member-table tbody th, .member-table tbody td { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 8px; padding: 5px 0; border: 0; font-weight: 400; }
  .member-table tbody th { font-weight: 600; }
  .member-table tbody th::before, .member-table tbody td::before { content: attr(data-label); color: var(--muted); font-size: .75rem; font-weight: 400; }
  .member-table tbody td:last-child:empty { display: none; }
  .member-table .button { justify-self: start; }
}

/* SaaS directory and invoices share compact rows and labelled mobile cells. */
.platform-filters { display: flex; flex-wrap: wrap; gap: 12px; margin-block: 16px; }
.platform-filters label { flex: 1 1 180px; min-width: 0; }
.platform-filters input, .platform-filters select { width: 100%; }
.platform-table-wrap { overflow-x: auto; margin-block: 12px; }
.platform-table { table-layout: auto; min-width: 1000px; }
.platform-table thead th:nth-child(n) { width: auto; }
.platform-account-identity { display: grid; gap: 4px; min-width: 0; }
.platform-row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
#platformView .section-heading { flex-wrap: wrap; }
#platformView .section-heading > * { min-width: 0; max-width: 100%; }
@media (max-width: 700px) {
  .platform-table { min-width: 0; }
  .platform-table tbody th, .platform-table tbody td { grid-template-columns: 100px minmax(0, 1fr); }
  .platform-table-wrap { overflow-x: visible; }
}

.platform-table thead th { overflow-wrap: normal; }

.photo-context-filter { margin-block: 12px; }
.photo-context-modes, .photo-context-choices { display: flex; flex-wrap: wrap; gap: 12px 20px; }
.photo-context-choices { margin-top: 14px; }
.photo-context-fallback { margin-top: 16px; }
.photo-context-label { display: block; margin-block: 8px; font-size: .85rem; }
.photo-provenance-button { color: var(--muted); }
.photo-provenance { margin-block: 10px; }
.photo-provenance summary { display: inline-flex; cursor: pointer; }
.photo-provenance[open] summary { margin-bottom: 12px; }
.photo-provenance label { display: grid; gap: 6px; margin-bottom: 12px; }
.photo-upload-list { display: grid; gap: 10px; }
.photo-upload-row { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.photo-upload-row strong { font-size: .8rem; overflow-wrap: anywhere; }
.training-photo-context { flex: none; margin: 0 0 6px; color: var(--muted); text-align: center; font-size: .78rem; }
