/* The pages' look, after the mockup: its color tokens, IBM Plex Sans for text and IBM Plex Mono for URLs and counts
   (PAGE-4), cards with a 12px radius and touch targets at least 44px tall (PAGE-6), and one column at every width
   that never scrolls sideways (PAGE-8). Every pair of text and background colors reaches 4.5:1 (PAGE-7). */

@font-face {
  font-family: 'IBM Plex Sans';
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/IBMPlexSans-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/IBMPlexSans-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/IBMPlexSans-SemiBold.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/IBMPlexMono-Regular.woff2') format('woff2');
}

:root {
  --background: #F4F1FB;
  --surface: #FFFFFF;
  --ink: #1E1433;
  --muted: #5A4E6E;
  --primary: #6B3FC4;
  --primary-hover: #522E9E;
  --primary-soft: #EDE6FB;
  --border: #E2DBF0;
  --input-border: #D3C8E6;
  --error: #9A3412;
  --error-background: #FDECE2;
  --success: #166534;
  --success-background: #E3F3E8;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background-color: var(--background);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  overflow-wrap: anywhere;
}

[hidden] { display: none !important; }

a { color: var(--primary); }
a:hover { color: var(--primary-hover); }

h1, h2, h3, p, ul { margin: 0; }

/* The header: the wordmark and, signed in, the initials button that opens the account menu. */

.header {
  background-color: var(--surface);
  color: var(--ink);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--primary);
  font-weight: 600;
  font-size: 18px;
  text-decoration: none;
}
.wordmark:hover { color: var(--primary-hover); }

.initials {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background-color: var(--ink);
  color: var(--surface);
  font: 600 14px/1 var(--sans);
  cursor: pointer;
}

.menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 16px;
  z-index: 10;
  min-width: 240px;
  max-width: calc(100vw - 32px);
  background-color: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(30, 20, 51, 0.12);
  padding: 8px;
  display: flex;
  flex-direction: column;
}

.menu-who {
  padding: 8px 12px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 14px;
}
.menu-email { display: block; color: var(--ink); font-weight: 500; }

.menu-item {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background-color: var(--surface);
  color: var(--ink);
  font: 500 15px var(--sans);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu-item:hover { background-color: var(--primary-soft); color: var(--ink); }

/* The page: one column, the same at every width. */

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 64px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.signed-out {
  align-items: flex-start;
  padding-top: 64px;
}

.card {
  background-color: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}

.card-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.card h1 { font-size: 28px; line-height: 1.2; font-weight: 600; }
.card h2 { font-size: 20px; line-height: 1.3; font-weight: 600; }
.card h3 { font-size: 15px; line-height: 1.4; font-weight: 600; }

.page-heading { font-size: 28px; line-height: 1.2; font-weight: 600; }

.muted { color: var(--muted); }

.website {
  font-family: var(--mono);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.bio {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* A long bio over 600 characters shows its first 7 lines until "Show all" (PROF-5). */
.bio-collapsed {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 7;
  line-clamp: 7;
  overflow: hidden;
}

.empty { color: var(--muted); }

/* The brokerage and team below the website, and the read view's lists (PROF-2, CARD-5). */

.identity-line { color: var(--muted); }

.items {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.appearance {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.site-name { font-weight: 600; }

/* Buttons and links that act as buttons: at least 44px tall. */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--input-border);
  background-color: var(--surface);
  color: var(--ink);
  font: 600 15px var(--sans);
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background-color: var(--primary-soft); color: var(--ink); }

.button-primary {
  border-color: var(--primary);
  background-color: var(--primary);
  color: var(--surface);
}
.button-primary:hover { border-color: var(--primary-hover); background-color: var(--primary-hover); color: var(--surface); }

.button-link {
  border-color: transparent;
  background-color: transparent;
  color: var(--primary);
  padding: 0 4px;
}
.button-link:hover { background-color: transparent; color: var(--primary-hover); }

.button:disabled,
.button:disabled:hover {
  border-color: var(--border);
  background-color: var(--border);
  color: var(--muted);
  cursor: not-allowed;
}

.button-danger {
  border-color: var(--error);
  background-color: var(--surface);
  color: var(--error);
}
.button-danger:hover { background-color: var(--error-background); color: var(--error); }

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

/* Chips and tags. */

.chip-required {
  background-color: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}

.tag-saved {
  background-color: var(--success-background);
  color: var(--success);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}

/* Fields in an open card. */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.field label { font-weight: 600; }

.help { color: var(--muted); font-size: 14px; }

.input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  background-color: var(--surface);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
}
.input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
textarea.input { resize: vertical; }
.input[aria-invalid='true'] { border-color: var(--error); }

.counter {
  align-self: flex-end;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}
.counter-over { color: var(--error); }

.field-error {
  color: var(--error);
  font-size: 14px;
}

/* A list's form: one row per item, its input beside Remove, then the Add button (CARD-4). */

.list-field {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.list-field legend {
  padding: 0;
  margin-bottom: 6px;
  font-weight: 600;
}

.list-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.list-row-input {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.list-row-input .input { flex: 1; min-width: 0; }
.list-row-input .button { flex: none; }

/* A failed save or deletion, inside its card. */
.message-error {
  background-color: var(--error-background);
  color: var(--error);
  border-radius: 8px;
  padding: 10px 12px;
}

/* A message at the top of a page, such as an invitation's result: plain, or in the success colors. */
.notice {
  background-color: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.notice-success {
  background-color: var(--success-background);
  color: var(--success);
  border-color: var(--success-background);
}

/* The in-app dialog: discard changes, delete the account. */

.dialog {
  max-width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  background-color: var(--surface);
  color: var(--ink);
}
.dialog::backdrop { background: rgba(30, 20, 51, 0.4); }
.dialog p { margin-bottom: 16px; }

/* The owner page: the scanning switch, and one row per pilot agent or invitation (OWNPG-1 to OWNPG-3). */

.switch {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background-color: transparent;
  color: var(--ink);
  font: 600 15px var(--sans);
  cursor: pointer;
}
.switch:disabled { cursor: not-allowed; }

.switch-track {
  position: relative;
  width: 44px;
  height: 26px;
  border: 2px solid var(--muted);
  border-radius: 999px;
  background-color: var(--surface);
}
.switch[aria-checked='true'] .switch-track {
  border-color: var(--primary);
  background-color: var(--primary);
  color: var(--surface);
}

.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: var(--muted);
  color: var(--surface);
}
.switch[aria-checked='true'] .switch-thumb { left: 21px; background-color: var(--surface); color: var(--ink); }

.switch-state { color: var(--muted); font-weight: 400; }

.rows {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.row:first-child { border-top: 0; }

.row-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.row-label {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.invitation-form,
.new-link {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Profile and Report: links in the header at 560px and wider, a bar along the bottom below that (NAV-5 to NAV-8). */

.page-links {
  display: none;
  align-items: stretch;
  gap: 4px;
  margin-right: auto;
}

.page-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}
.page-link:hover { color: var(--ink); }
.page-link[aria-current='page'] { color: var(--ink); border-bottom-color: var(--primary); }

.tab-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  background-color: var(--surface);
  color: var(--ink);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 56px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}
.tab[aria-current='page'] { color: var(--primary); font-weight: 600; }

.keyboard-open .tab-bar { display: none; }

@media (max-width: 559.98px) {
  .has-tab-bar { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
}

@media (min-width: 560px) {
  .page-links:not([hidden]) { display: flex; }
  .tab-bar { display: none; }
}

/* The first-scan card on the profile page (NAV-11). */

.first-scan { border-color: var(--primary); }

/* The report page: its head, the banner of a scan in progress or failed, and the scan ID (REP-1, REP-2, REP-16). */

.report-name { font-size: 20px; font-weight: 600; overflow-wrap: anywhere; }

.report-who {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.banner {
  background-color: var(--primary-soft);
  color: var(--ink);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.banner-error {
  background-color: var(--error-background);
  color: var(--error);
}

.banner-title { font-weight: 600; }

.steps {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.step {
  padding: 4px 10px;
  border: 1px solid var(--input-border);
  border-radius: 999px;
  background-color: var(--surface);
  color: var(--muted);
  font-size: 14px;
}
.step-done {
  border-color: var(--primary);
  background-color: var(--primary);
  color: var(--surface);
}
.step-current {
  border-color: var(--primary);
  color: var(--ink);
  font-weight: 600;
}

.report-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.scan-id {
  color: var(--muted);
  font-size: 13px;
  user-select: text;
}

/* The owner page's scan costs and raw material (OWNPG-5, OWNPG-6). */

.cost-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.cost-group:first-child { border-top: 0; }

.typical { font-weight: 600; }

.cost-row summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.raw-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.raw-group h3 { margin-top: 8px; }
.raw-group a { overflow-wrap: anywhere; }

/* The report: lens tiles, severity chips, filters, findings and their evidence (REP-3 to REP-14, REP-17). */

.how-you-show-up {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 519.98px) {
  .tiles { grid-template-columns: 1fr; }
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-height: 44px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background-color: var(--surface);
  color: var(--ink);
  font: 15px/1.4 var(--sans);
  text-align: left;
  cursor: pointer;
}
.tile[aria-pressed='true'] { border-color: var(--primary); outline: 2px solid var(--primary); }
.tile-name { font-weight: 600; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  font-size: 13px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
}
.chip-high { background-color: var(--error-background); color: var(--error); }
.chip-medium { background-color: var(--primary-soft); color: var(--ink); }
.chip-low { background-color: var(--background); color: var(--muted); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.filter[aria-pressed='true'] { border-color: var(--primary); background-color: var(--primary-soft); color: var(--ink); }

.finding-list {
  display: flex;
  flex-direction: column;
}

.finding {
  border-top: 1px solid var(--border);
  padding: 4px 0;
}

.finding-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  cursor: pointer;
}

.finding-title { font-weight: 600; overflow-wrap: anywhere; }

.lens-tag {
  font-size: 13px;
  color: var(--muted);
}

.explanation { margin: 4px 0 8px; }

.evidence {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border-radius: 8px;
  background-color: var(--background);
  color: var(--ink);
  overflow-wrap: anywhere;
}

.what-to-do { margin-top: 12px; overflow-wrap: anywhere; }

.actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-left: 24px;
}
.actions-one { padding-left: 0; list-style: none; }
.action-title { margin: 0 0 4px; font-weight: 600; }

.steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 24px;
}
.step-link { display: block; }
.step-brokerage {
  padding: 8px 12px;
  border-left: 4px solid var(--primary);
  border-radius: 4px;
  background-color: var(--primary-soft);
  color: var(--ink);
}

.url { font-family: var(--mono); font-size: 14px; overflow-wrap: anywhere; }
.quote { font-style: italic; }
.label { font-weight: 600; }

.results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 0;
  list-style: none;
}

.result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.rank { font-family: var(--mono); color: var(--muted); }

.class-label {
  font-size: 13px;
  padding: 1px 8px;
  border-radius: 999px;
}
.class-mine { background-color: var(--success-background); color: var(--success); }
.class-someone-else { background-color: var(--error-background); color: var(--error); }
.class-unsure { background-color: var(--surface); color: var(--muted); }

.answer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.citations { padding-left: 20px; }

.button-small { min-height: 44px; padding: 0 12px; font-size: 14px; }

.might-be-you { font-weight: 600; }

.possible-title { font-weight: 600; overflow-wrap: anywhere; }
.answered { color: var(--success); font-weight: 600; }

.topic-label {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-weight: 600;
}

.tag {
  font-size: 13px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  background-color: var(--primary-soft);
  color: var(--ink);
}

.how-we-asked summary,
.topic-findings summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.place .state { color: var(--muted); }
