/* Ported from the brand system in trustabike-site.html and
   trustabike_inspection_checklist.html — same tokens, same component
   language (pill buttons, rounded cards, mono labels, green accent). */

:root {
  --ink: #14202E;
  --ink-70: rgba(20, 32, 46, .68);
  --ink-45: rgba(20, 32, 46, .44);
  --ink-25: rgba(20, 32, 46, .25);
  --green: #2E7D4F;
  --green-dark: #245F3D;
  --green-bg: #E7F3EB;
  --olive: #6E9C3E;
  --olive-dark: #4C6B2B;
  --olive-bg: #EEF3E1;
  --amber: #B8760F;
  --amber-bg: #FBF0DD;
  --red: #B23A2C;
  --red-bg: #FBEAE7;
  --paper: #FAF9F6;
  --paper-raised: #FFFFFF;
  --paper-sunk: #F3F1EB;
  --line: #E4E0D5;
  --line-strong: #CFC9B8;
  --display: 'Space Grotesk', sans-serif;
  --body: 'Inter', sans-serif;
  --mono: 'IBM Plex Mono', monospace;
  --shadow-card: 0 1px 2px rgba(20, 32, 46, .04), 0 8px 24px -12px rgba(20, 32, 46, .10);
  --shadow-raised: 0 4px 10px rgba(20, 32, 46, .06), 0 16px 40px -16px rgba(20, 32, 46, .18);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
:focus-visible { outline: 2.5px solid var(--green); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--green); color: #fff; }

/* ---------- Header / nav ---------- */
header.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(250, 249, 246, .94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar {
  max-width: 1100px; margin: 0 auto; padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between; height: 72px; gap: 16px;
}
.logo {
  font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: -.01em;
  text-decoration: none; color: var(--ink);
}
.logo .b { color: var(--green); }
.navlinks { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.navlinks a { text-decoration: none; font-size: 14px; font-weight: 600; color: var(--ink-70); }
.navlinks a:hover { color: var(--ink); }
.navlinks .btn { font-size: 13.5px; padding: 8px 16px; }

/* ---------- Layout ---------- */
.container { max-width: 900px; margin: 0 auto; padding: 36px 24px 60px; }

h1 {
  font-family: var(--display); font-weight: 600; letter-spacing: -0.02em;
  font-size: clamp(26px, 3.4vw, 36px); margin: 0 0 6px; line-height: 1.1;
}
h2 {
  font-family: var(--display); font-weight: 600; letter-spacing: -0.015em;
  font-size: 19px; margin: 34px 0 14px;
}
.subtitle { color: var(--ink-45); margin-top: 0; margin-bottom: 26px; font-size: 15px; }
.kicker {
  font-family: var(--mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--green-dark); font-weight: 500; display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
}
.kicker::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; }

/* ---------- Cards ---------- */
.card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 22px 24px;
  margin-bottom: 18px;
}

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; margin-top: 6px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
th {
  color: var(--ink-45); font-weight: 500; font-size: 11px; text-transform: uppercase;
  letter-spacing: .04em; font-family: var(--mono);
}
tr:last-child td { border-bottom: none; }

/* ---------- Badges / pills ---------- */
.badge, .pill {
  display: inline-block; font-family: var(--mono); font-weight: 500;
  font-size: 11px; letter-spacing: .02em; padding: 4px 11px; border-radius: 999px;
}
.badge-draft { background: var(--paper-sunk); color: var(--ink-45); }
.badge-submitted { background: var(--amber-bg); color: var(--amber); }
.badge-certified { background: var(--green-bg); color: var(--green-dark); }
.badge-rejected { background: var(--red-bg); color: var(--red); }
/* A field whose value was read from one of the bike's photos and hasn't
   been reviewed yet. Deliberately quiet and neutral — it asks for a check
   without announcing where the value came from. */
.badge-photo {
  background: var(--paper-sunk); color: rgba(20, 32, 46, .72); font-size: 10px; font-weight: 400;
  padding: 2px 8px; margin-left: 6px; vertical-align: 1px; white-space: nowrap;
}

/* ---------- Grade display ---------- */
.grade-big {
  font-family: var(--display); font-size: 46px; font-weight: 700; line-height: 1;
  margin-bottom: 6px;
}
.grade-A { color: #2E7D4F; }
.grade-B { color: #6E9C3E; }
.grade-C { color: var(--amber); }
.grade-D { color: var(--red); }

/* ---------- Buttons ---------- */
button, .btn, input[type=submit] {
  font-family: var(--body); font-weight: 600; font-size: 14.5px;
  padding: 11px 22px; border-radius: 999px; text-decoration: none; display: inline-block;
  border: 1.5px solid transparent; cursor: pointer;
  transition: transform .15s ease, background .15s, border-color .15s;
}
button:hover, .btn:hover, input[type=submit]:hover { transform: translateY(-1px); }
button, .btn-primary, input[type=submit] { background: var(--ink); color: #fff; }
button:hover, .btn-primary:hover, input[type=submit]:hover { background: #0B1526; }
.btn-secondary, .btn-ghost { border-color: var(--line-strong); color: var(--ink); background: transparent; }
.btn-secondary:hover, .btn-ghost:hover { border-color: var(--ink); background: transparent; }
.btn-danger { background: var(--red); color: #fff; }

/* ---------- Forms ---------- */
form .field { margin-bottom: 20px; }
label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 7px; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; font-family: var(--body); font-size: 14.5px;
  padding: 11px 14px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--paper); color: var(--ink);
}
select[multiple] { padding: 6px; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2.5px solid var(--green); outline-offset: 1px; border-color: transparent;
}
select:disabled, input:disabled { color: var(--ink-45); cursor: not-allowed; background: var(--paper-sunk); }

/* ---------- Bike details: "Who is selling this bike?" ---------- */
/* Same selected-state language as the checklist's rating pills (green
   border + tint via :has(input:checked)), but stacked full-width because
   each option is a sentence rather than a word. */
.basis-pick { display: flex; flex-direction: column; gap: 8px; }
.basis-option {
  display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 11px 14px;
  font-weight: 500; font-size: 14px; cursor: pointer;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--paper);
  transition: border-color .15s, background .15s;
}
.basis-option input { flex: 0 0 auto; margin: 3px 0 0; }
.basis-option:has(input:checked) { border-color: var(--green); background: var(--green-bg); color: var(--green-dark); }
/* Lets the "From photo · check" tag sit on the same line as a label on
   the bike details form (labels are otherwise block-level). */
.field[data-photo-field] > label { display: inline-block; }
.field-hint { font-size: 12.5px; color: var(--ink-45); margin: 8px 0 0; }
.field-errors { color: var(--red); font-size: 12.5px; margin-top: 6px; }

/* ---------- Flash messages ---------- */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; font-weight: 500; }
.flash-success { background: var(--green-bg); color: var(--green-dark); }
.flash-error { background: var(--red-bg); color: var(--red); }
.flash-info { background: var(--paper-sunk); color: var(--ink-70); }

/* ---------- Checklist ---------- */
.checklist-section.card { padding: 20px 22px 8px; }
.checklist-item {
  background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 16px 18px; margin: 0 0 12px;
}
.checklist-item-label { font-weight: 700; font-size: 14.5px; color: var(--ink); margin-bottom: 10px; }
.rating-options { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.rating-options label {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 13px;
  border: 1.5px solid var(--line-strong); border-radius: 999px; padding: 6px 13px; cursor: pointer;
  background: var(--paper); transition: border-color .15s, background .15s;
}
.rating-options label:has(input:checked) { border-color: var(--green); background: var(--green-bg); color: var(--green-dark); }
.spec-fields { display: flex; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.spec-fields .field { flex: 1; min-width: 160px; margin-bottom: 0; }

/* ---------- Checklist progress meter ---------- */
/* Shared by the overall summary card and every section header, so both
   look and behave identically — only the size/weight of the percentage
   number differs (see .progress-pct.is-section) to keep the overall
   figure visually senior to each section's own figure. */
.progress-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.progress-head.count-only { justify-content: flex-end; margin-bottom: 10px; }
.progress-label {
  font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-70);
}
.progress-count { font-family: var(--mono); font-size: 12px; color: var(--ink-70); }
.progress-row { display: flex; align-items: center; gap: 16px; }
.progress-pct { font-family: var(--display); font-weight: 700; font-size: 38px; line-height: 1; min-width: 82px; }
.progress-pct.is-section { font-weight: 600; font-size: 30px; min-width: 70px; color: var(--ink-70); }
.progress-bar-track { flex: 1; height: 12px; border-radius: 999px; background: var(--paper-sunk); overflow: hidden; }
.progress-bar-fill {
  height: 100%; border-radius: 999px; width: 0%; background: var(--line-strong);
  transition: width .25s ease, background-color .25s ease;
}
.grade-pill {
  font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .02em;
  padding: 4px 11px; border-radius: 999px; white-space: nowrap;
}

.checklist-section-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  background: none; border: none; padding: 0; margin: 0 0 14px; cursor: pointer;
  font-family: var(--display); font-weight: 600; font-size: 17px; color: var(--ink); text-align: left;
}
.checklist-section-chevron { display: inline-block; transition: transform .15s; font-size: 13px; color: var(--ink-70); flex: 0 0 auto; }
.checklist-section.is-collapsed .checklist-section-chevron { transform: rotate(-90deg); }
.checklist-section.is-collapsed .checklist-section-body { display: none; }
.checklist-section-body { margin-top: 18px; }

.errors { color: var(--red); font-size: 12px; margin-top: 5px; }
.empty-state { color: var(--ink-45); font-style: italic; padding: 24px 0; font-size: 14.5px; }

/* ---------- Rich-text description editor (inspector profile) ---------- */
.richtext-toolbar { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.richtext-toolbar button {
  font-size: 13px; padding: 6px 11px; border-radius: 8px; border: 1.5px solid var(--line-strong);
  background: #fff; color: var(--ink); cursor: pointer; font-weight: 600;
}
.richtext-toolbar button:hover { border-color: var(--ink); }
.richtext-editor {
  min-height: 140px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 14.5px; line-height: 1.6; background: #fff;
}
.richtext-editor:focus { outline: 2.5px solid var(--green); outline-offset: 1px; }
.richtext-editor ul, .richtext-editor ol { margin: 6px 0; padding-left: 22px; }
.richtext-editor p { margin: 0 0 10px; }

/* ---------- Public certificate ---------- */
.cert-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.cert-number {
  font-family: var(--mono); font-size: 11px; color: var(--ink-45); text-align: right; line-height: 1.5;
  text-transform: uppercase; letter-spacing: .03em;
}

/* ---------- Photo upload grid (inspector checklist page) ---------- */
.photos-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.photos-count { font-size: 12.5px; color: var(--ink-45); font-family: var(--mono); }
.photos-hint { font-size: 13.5px; color: var(--ink-45); margin: 6px 0 18px; }
.photos-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.photo-tile {
  position: relative; border: 1.5px solid var(--line); border-radius: var(--radius-md);
  overflow: hidden; aspect-ratio: 1; background: var(--paper-sunk);
}
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tile.is-primary { border-color: var(--green); box-shadow: 0 0 0 2px var(--green-bg); }
.photo-primary-badge {
  position: absolute; top: 6px; left: 6px; background: var(--green); color: #fff;
  font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
}
.photo-controls { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; }
.photo-btn {
  width: 22px; height: 22px; border-radius: 6px; border: none;
  background: rgba(20, 32, 46, .68); color: #fff; display: flex; align-items: center;
  justify-content: center; cursor: pointer; padding: 0; font-size: 14px; line-height: 1;
}
.photo-btn:hover { background: rgba(20, 32, 46, .88); }
.photo-set-primary-btn {
  position: absolute; bottom: 6px; left: 6px; right: 6px; font-size: 10.5px; font-weight: 600;
  background: rgba(255, 255, 255, .94); color: var(--ink); border: 1px solid var(--line-strong);
  border-radius: 6px; padding: 5px 0; cursor: pointer;
}
.photo-set-primary-btn:hover { background: #fff; border-color: var(--ink); }

.photos-add-btn.disabled { opacity: .4; pointer-events: none; }

/* ---------- Standard photo set (the eight named tiles) ---------- */
/* One square tile per slot in photo_slots.SLOTS. An empty tile is the
   upload control itself and shows that angle's outline drawing + label;
   a filled one shows the photo with its label as a chip. Deliberately the
   same tile language as before (radius, borders, primary ring), just
   four fixed columns so the set reads as two rows of four. */
.shot-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.shot-form { margin: 0; display: block; }
.shot-tile {
  position: relative; display: block; aspect-ratio: 1; margin: 0; overflow: hidden;
  border: 1.5px solid var(--line); border-radius: var(--radius-md); background: var(--paper-sunk);
}
.shot-tile.is-filled img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot-tile.is-primary { border-color: var(--green); box-shadow: 0 0 0 2px var(--green-bg); }
.shot-tile.is-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 10px; border-style: dashed; border-color: var(--line-strong);
  color: rgba(20, 32, 46, .55); cursor: pointer; font-weight: 400;
  transition: border-color .15s, color .15s, background .15s;
}
.shot-tile.is-empty:hover, .shot-tile.is-empty:focus-within { border-color: var(--ink); color: var(--ink); background: var(--paper); }
.shot-tile.is-empty:focus-within { outline: 2.5px solid var(--green); outline-offset: 2px; }
.shot-tile.is-busy { opacity: .5; pointer-events: none; }
.shot-art { width: 78%; height: auto; display: block; }
.shot-label {
  font-family: var(--mono); font-size: 11px; letter-spacing: .04em; text-transform: uppercase;
  color: rgba(20, 32, 46, .72); text-align: center; line-height: 1.3;
}
/* Kept in the layout (so the tile is keyboard-reachable and the label
   opens the picker) but visually out of the way. */
.shot-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.shot-chip {
  position: absolute; left: 6px; bottom: 6px; max-width: calc(100% - 12px);
  background: rgba(20, 32, 46, .78); color: #fff; font-family: var(--mono); font-size: 10px;
  letter-spacing: .04em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.shot-help { font-size: 12.5px; color: var(--ink-45); margin: 14px 0 0; }
.shot-next { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.shot-next-note { font-size: 13.5px; color: var(--ink-45); }
@media (max-width: 560px) {
  .shot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Certificate hero photo carousel ---------- */
.cert-hero {
  background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-raised); margin-bottom: 18px;
}
.cert-hero-photo-placeholder {
  width: 100%; aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center;
  background: var(--paper-sunk); color: var(--ink-45); font-size: 13.5px;
}
.cert-hero-carousel { position: relative; width: 100%; aspect-ratio: 16/9; overflow: hidden; background: var(--paper-sunk); }
.cert-carousel-track { display: flex; width: 100%; height: 100%; transition: transform .35s ease; }
.cert-carousel-slide { flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover; display: block; }
.cert-carousel-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 36px; height: 36px;
  border-radius: 999px; border: none; background: rgba(255, 255, 255, .9); color: var(--ink);
  font-family: var(--body); font-size: 19px; line-height: 1; display: flex; align-items: center;
  justify-content: center; cursor: pointer; box-shadow: var(--shadow-card); transition: background .15s;
}
.cert-carousel-nav:hover { background: #fff; }
.cert-carousel-nav.prev { left: 14px; }
.cert-carousel-nav.next { right: 14px; }
.cert-carousel-dots {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); display: flex;
  gap: 7px; padding: 6px 10px; background: rgba(20, 32, 46, .35); border-radius: 999px;
}
.cert-carousel-dot { width: 7px; height: 7px; border-radius: 999px; border: none; background: rgba(255, 255, 255, .55); padding: 0; cursor: pointer; }
.cert-carousel-dot.active { background: #fff; }
.cert-carousel-count {
  position: absolute; top: 14px; right: 14px; font-size: 11.5px; font-weight: 600; color: #fff;
  background: rgba(20, 32, 46, .55); padding: 4px 10px; border-radius: 999px;
}

/* ---------- Mobile layout (Oct 2026 mobile review) ---------- */
/* Header account button lives beside the nav (see base.html). Desktop:
   same single row as before — nav links, then the button. */
.topbar .navlinks { margin-left: auto; }
.nav-account { flex-shrink: 0; margin-left: 6px; }
.nav-account .btn { font-size: 13.5px; padding: 8px 16px; }
.nav-account .btn-ghost { color: var(--ink-70); }

@media (max-width: 760px) {
  /* Logo + account button on one row; nav links on a second row that
     scrolls sideways if an admin's five links don't fit. The fixed 72px
     height used to push the wrapped links up out of the header. */
  .topbar { height: auto; flex-wrap: wrap; padding: 12px 18px 0; row-gap: 4px; }
  .topbar .logo { margin-right: auto; }
  .nav-account { margin-left: 0; }
  .nav-account-name { display: none; }
  .topbar .navlinks {
    order: 3; width: 100%; margin-left: 0; flex-wrap: nowrap; gap: 20px;
    overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
    padding: 8px 0 12px;
  }
  .topbar .navlinks::-webkit-scrollbar { display: none; }
  .topbar .navlinks a { white-space: nowrap; flex-shrink: 0; }
}

@media (max-width: 640px) {
  .container { padding: 24px 16px 48px; }
  .card { padding: 18px 16px; }
  .checklist-section.card { padding: 16px 14px 4px; }
  .checklist-item { padding: 14px; }
  .progress-pct { font-size: 32px; min-width: 0; }
  .progress-pct.is-section { font-size: 26px; min-width: 0; }
  .progress-row { gap: 12px; }
  .spec-fields .field { min-width: 100%; }
  td, th { overflow-wrap: anywhere; }

  /* Data tables → one card per row, each value labelled with its column
     heading (labels are added by the script in base.html). */
  table.table-stack, table.table-stack tbody, table.table-stack tr, table.table-stack td { display: block; width: 100%; }
  table.table-stack thead { display: none; }
  table.table-stack tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  table.table-stack tr:last-child { border-bottom: none; }
  table.table-stack td { border: none; padding: 4px 0 4px 108px; position: relative; min-height: 26px; }
  table.table-stack td::before {
    content: attr(data-label); position: absolute; left: 0; top: 7px; width: 96px;
    font-family: var(--mono); font-size: 10.5px; line-height: 1.4; text-transform: uppercase;
    letter-spacing: .04em; color: var(--ink-45);
  }
  /* Cells with no heading (row actions, avatars) span the full width */
  table.table-stack td:not([data-label]) { padding-left: 0; min-height: 0; }
  table.table-stack td:not([data-label])::before { content: none; }
  table.table-stack button, table.table-stack .btn, table[data-no-stack] button { white-space: nowrap; }
  table.table-stack td:first-child { font-weight: 600; }
  table.table-stack td:last-child:not([data-label]) { padding-top: 10px; }
}
