/* The stylesheet of every page of the system (not the landing page, not the
   calculator). One file, built from a few components; pages only combine
   them. See docs/dev/frontend.md#stylesheet.

   Rules that keep pages tidy at any width:
   - Nothing styles bare elements beyond typography and form fields: a
     button looks like a button because it has .btn and a variant.
   - Every button has the same box (border, line height, min height), so
     buttons side by side always share their height and centre line.
   - Buttons that belong together go in a group (.button-stack, .button-row,
     .button-grid), which gives them equal widths and aligned edges.
   - Side margins come from the page container only (--gutter). */

/* ——— Tokens ——— */
:root {
  --page-bg: #F4F7F9;
  --surface: #FAFCFF;
  --surface-alt: #F0F4F8;
  --surface-hover: #E9EFF6;

  --navy: #192646;
  --primary: #11224e;
  --primary-hover: #1d2c7e;
  --navy-light: #2d67be;
  --gold: #B8933E;

  --text-heading: #112b4c;
  --text: #333333;
  --text-muted: #666666;
  --text-faint: #999999;

  --border: #dde2e8;
  --border-light: #eaeef2;
  --border-field: #c5ccd6;

  --danger: #c0392b;
  --danger-hover: #962d22;
  --danger-light: #fdecea;
  --danger-border: #f5c6c0;
  --warning-bg: #fff8e1;
  --warning-bg-strong: #fff3cd;
  --warning-border: #f0c14b;
  --warning-text: #6b4f00;
  --success-light: #eef7f1;
  --success-border: #b6e2c8;
  --attention: #D4A017;
  --attention-bg: #dceaf8;
  --attention-border: #4ea6ff;

  --radius: 6px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 3px rgba(16, 30, 54, 0.06);
  --shadow: 0 2px 8px rgba(16, 30, 54, 0.07);
  --shadow-lg: 0 10px 30px rgba(16, 30, 54, 0.18);
  --focus-ring: 0 0 0 3px rgba(45, 103, 190, 0.35);

  --control-height: 44px;
  --gutter: 24px;  /* the page's side margin */
  --card-padding: 24px;
}

/* Phones (the layout switches at 600px; the top bar at 1100px). */
@media (max-width: 599px) {
  :root {
    --gutter: 16px;
    --card-padding: 16px;
  }
}

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

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

body {
  margin: 0;
  font-family: 'Lato', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--page-bg);
  overflow-wrap: break-word;
}

h1, h2, h3 {
  margin: 0 0 16px;
  color: var(--text-heading);
  line-height: 1.25;
}

h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }

@media (max-width: 599px) {
  h1 { font-size: 23px; }
  h2 { font-size: 20px; }
}

p { margin: 0 0 12px; }

a { color: var(--navy-light); }

ul, ol { margin: 0; padding: 0; list-style: none; }

img { max-width: 100%; }

blockquote { margin: 0; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ——— Page frame ——— */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px var(--gutter) 64px;
}

main {
  max-width: 1000px;
  margin: 0 auto;
}

/* Pages that are a single small form. */
main.narrow { max-width: 460px; }

#welcome-message {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 15px;
}

/* ——— Top bar ——— */
.site-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  padding: 16px 20px;
  background-color: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand a { display: block; flex-shrink: 0; }

.logo {
  display: block;
  height: 56px;
  width: auto;
}

.site-title {
  max-width: 260px;
  color: var(--navy);
  font-size: 17px;
  letter-spacing: 1.2px;
  line-height: 1.25;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-button,
#language-selector {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  margin: 0;
  padding: 0 18px;
  font: inherit;
  font-size: 16px;
  line-height: 1;
  color: var(--navy);
  background-color: transparent;
  border: 1px solid var(--navy);
  border-radius: var(--radius);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.nav-button:hover {
  background-color: var(--navy);
  color: #fff;
}

.nav-button:focus-visible,
#language-selector:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

#language-selector {
  width: auto;
  min-height: 0;
  padding-right: 38px;
  background-position: right 12px center;
}

#language-selector:hover { background-color: var(--surface-hover); }

#logout-button {
  border-color: var(--danger);
  color: var(--danger);
}

#logout-button:hover {
  background-color: var(--danger);
  color: #fff;
}

/* The unseen-notifications count, inside the button (never over its edge). */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  margin-left: 8px;
  padding: 0 6px;
  border-radius: 11px;
  background-color: var(--navy);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.nav-button:hover .badge {
  background-color: #fff;
  color: var(--navy);
}

/* The menu button (phones). Two drawn icons, one shown at a time: the X is
   a single SVG path, so it is exact at any size. */
.hamburger { display: none; }

@media (max-width: 1099px) {
  .hamburger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    color: var(--navy);
    border-radius: var(--radius);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .hamburger svg {
    display: block;
    width: 28px;
    height: 28px;
  }

  .hamburger .icon-close,
  #nav-toggle:checked + .hamburger .icon-open { display: none; }

  #nav-toggle:checked + .hamburger .icon-close { display: block; }

  #nav-toggle:focus-visible + .hamburger { box-shadow: var(--focus-ring); }

  /* The menu opens under the bar, as wide as the bar. */
  .nav-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 50;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 16px;
    background-color: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
  }

  #nav-toggle:checked ~ .nav-menu { display: flex; }

  .nav-menu .nav-button,
  .nav-menu #language-selector {
    width: 100%;
    height: var(--control-height);
    text-align: center;
    text-align-last: center;
  }
}

@media (max-width: 599px) {
  .site-header {
    gap: 8px;
    margin-bottom: 20px;
    padding: 10px 10px 10px 14px;
  }

  .brand { gap: 10px; }

  .logo { height: 38px; }

  .site-title {
    max-width: none;
    font-size: 15px;
    letter-spacing: 0.4px;
  }
}

/* ——— Cards ——— */
.card {
  margin-bottom: 20px;
  padding: var(--card-padding);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card > :last-child { margin-bottom: 0; }

.card-title {
  margin-bottom: 16px;
  color: var(--navy);
  font-size: 20px;
}

/* ——— Form fields ——— */
label {
  display: block;
  margin: 0 0 6px;
  font-weight: 700;
  color: var(--text);
}

input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
select,
textarea {
  display: block;
  width: 100%;
  min-height: var(--control-height);
  margin: 0 0 18px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background-color: #fff;
  border: 1px solid var(--border-field);
  border-radius: var(--radius);
}

textarea {
  min-height: 130px;
  resize: vertical;
}

input:not([type=checkbox]):not([type=radio]):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--navy-light);
  box-shadow: var(--focus-ring);
}

select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='20' height='20' fill='%23192646'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

input[type=file] {
  padding: 6px;
  cursor: pointer;
}

/* On a phone the button takes the first line and the file's name the
   second, so the name is not cut short. */
@media (max-width: 599px) {
  input[type=file] { white-space: normal; }

  input[type=file]::file-selector-button {
    display: block;
    width: 100%;
    margin: 0 0 6px;
  }
}

input[type=file]::file-selector-button {
  height: 32px;
  margin-right: 12px;
  padding: 0 14px;
  font: inherit;
  font-weight: 700;
  color: var(--navy);
  background-color: var(--surface);
  border: 1px solid var(--navy);
  border-radius: var(--radius);
  cursor: pointer;
}

.field-title {
  margin: 0 0 6px;
  font-weight: 700;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

/* ——— Buttons ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--control-height);
  max-width: 100%;
  margin: 0;
  padding: 8px 20px;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}

.btn-primary {
  color: #fff;
  background-color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(17, 34, 78, 0.25);
}

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

.btn-secondary {
  color: var(--navy);
  background-color: var(--surface);
  border-color: var(--navy);
}

.btn-secondary:hover {
  color: #fff;
  background-color: var(--navy);
}

/* Cancel, Back: present but quiet. */
.btn-neutral {
  color: #444;
  font-weight: 400;
  background-color: #eceff3;
  border-color: #cfd5dd;
}

.btn-neutral:hover {
  background-color: #dfe3e9;
  border-color: #b7bec8;
}

.btn-danger {
  color: #fff;
  background-color: var(--danger);
  border-color: var(--danger);
}

.btn-danger:hover {
  background-color: var(--danger-hover);
  border-color: var(--danger-hover);
}

.btn-danger-outline {
  color: var(--danger);
  background-color: transparent;
  border-color: var(--danger);
}

.btn-danger-outline:hover {
  color: #fff;
  background-color: var(--danger);
}

.btn-small {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 14px;
}

/* Icons drawn in the button's text colour. */
.icon-pdf::before,
.icon-download::before,
.icon-add-user::before,
.icon-plus::before {
  content: "";
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background-color: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.icon-pdf { --icon: url('/pdf.svg'); }
.icon-download { --icon: url('/download.svg'); }
.icon-add-user { --icon: url('/add_user.svg'); }
.icon-plus {
  --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 5v14M5 12h14' stroke='black' stroke-width='2.5' stroke-linecap='round'/></svg>");
}

/* ——— Button groups ——— */
/* Small forms that are only a button (logout, delete, approve) take no room
   of their own: their button sits in the surrounding layout. */
form.inline-form:not([hidden]) { display: contents; }

/* Buttons one above the other, all as wide as the widest allowed. */
.button-stack {
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 360px;
  margin: 24px auto 0;
}

.button-stack.wide { max-width: none; }

/* Buttons side by side, equal widths. */
.button-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 12px;
}

/* A few buttons: one centred row of equal widths (never a ragged second
   row); one column on a phone. */
.button-grid {
  display: grid;
  gap: 12px;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 300px);
  justify-content: center;
}

@media (max-width: 599px) {
  .button-grid {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: 1fr;
  }
}

.button-stack > *,
.button-row > *,
.button-grid > * { width: 100%; }

/* ——— Messages ——— */
.notice {
  margin: 0 0 20px;
  padding: 12px 16px;
  background-color: var(--surface);
  border-left: 4px solid var(--navy);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.form-error {
  margin: 0 0 16px;
  padding: 10px 14px;
  color: var(--danger);
  background-color: var(--danger-light);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius);
}

.hint {
  margin: -12px 0 18px;
  color: var(--text-muted);
  font-size: 14px;
}

.form-context {
  margin: 0 0 4px;
  color: var(--text-muted);
  font-size: 14px;
}

.empty-state {
  margin: 0 0 20px;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  background-color: var(--surface-alt);
  border-radius: var(--radius-lg);
}

.empty-state p { margin: 0; }

.timestamp {
  color: #101010;
  font-weight: 700;
  font-size: 0.9em;
}

.inline-icon {
  height: 1.1em;
  width: auto;
  vertical-align: -0.2em;
  margin-right: 6px;
}

.quote {
  margin: 8px 0 12px;
  padding: 8px 12px;
  white-space: pre-wrap;
  background-color: var(--surface-alt);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.pending-warning {
  color: var(--danger);
  font-weight: 700;
}

.pending-banner { margin: 0 0 16px; }

.error-page {
  max-width: 560px;
  margin: 40px auto 0;
  text-align: center;
}

/* ——— Sign-in, sign-up, password ——— */
.auth-title { text-align: center; }

.auth-form .button-stack { max-width: none; margin-top: 4px; }

.btn-google {
  color: #3c4043;
  font-weight: 400;
  background-color: #fff;
  border-color: #dadce0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.btn-google:hover {
  background-color: #f8f9fa;
  border-color: #c6c9cc;
}

.btn-google svg { flex-shrink: 0; }

.auth-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 20px 0 0;
  text-align: center;
}

.auth-links p { margin: 0; }

.auth-links a {
  color: #0049bd;
  font-weight: 700;
  text-decoration: none;
}

.auth-links a:hover { text-decoration: underline; }

/* ——— Dashboard ——— */
.process-list { margin: 0 0 28px; }

.thread-item {
  margin: 0 0 14px;
  padding: 16px 20px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-left: 5px solid var(--navy);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

@media (max-width: 599px) {
  .thread-item { padding: 14px; }
}

#threadList .thread-item {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 12px;
  transition: box-shadow 0.2s;
}

#threadList .thread-item:hover { box-shadow: 0 6px 18px rgba(16, 30, 54, 0.1); }

.thread-item.thread-attention {
  background-color: var(--attention-bg);
  border-left-color: var(--attention-border);
}

.thread-info {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 20px;
  min-width: 0;
}

.thread-link {
  color: var(--navy);
  font-weight: 700;
  text-decoration: none;
}

.thread-link:hover { text-decoration: underline; }


.thread-vs {
  color: var(--navy);
  font-style: italic;
  font-size: 0.95em;
}

.attention-badge { grid-column: 2; grid-row: 1; cursor: default; }

.attention-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--attention);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
}

.countdowns-in-thread {
  grid-column: 1 / -1;
  margin-top: 10px;
  padding: 8px 12px;
  font-size: 0.92em;
  color: #5d4037;
  background-color: var(--warning-bg);
  border-left: 4px solid var(--warning-border);
  border-radius: var(--radius);
}

.countdowns-in-thread p { margin: 0; }

.countdown-expired { color: var(--danger) !important; font-weight: 700; }

/* ——— Process page ——— */
.process-title span { display: inline-block; }

.full-process-container {
  margin: 0 0 20px;
  padding: 16px var(--card-padding);
  text-align: center;
  background-color: var(--surface-alt);
  border: 2px solid var(--navy);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 12px rgba(25, 38, 70, 0.15);
}

#merged-pdf-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 20px;
}

#merged-pdf-container p { margin: 0; }

#merged-pdf-container .button-row { width: min(100%, 340px); }

/* A document's View button (opened by pdf-viewer.js). */
.pdf-load-span { white-space: nowrap; }

.pdf-load-span.loading { opacity: 0.7; cursor: progress; pointer-events: none; }

.pdf-load-span.loading::after {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.pdf-load-span.error {
  color: #fff;
  background-color: var(--danger);
  border-color: var(--danger);
  white-space: normal;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* "Attached document: [file]" */
.attachment {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 12px 0 0;
}

.attachment p { margin: 0; font-weight: 700; }

.attachment .pdf-load-span { min-width: 0; }

/* On a phone every entry has the same shape: date above author, label above file. */
@media (max-width: 599px) {
  .attachment,
  .publication-meta,
  .notification-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

.pending-approval-container .button-stack { margin: 0 auto; }

#participants-container { margin-bottom: 20px; }

#participants-header-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-light);
}

#participants-header-container h3 {
  margin: 0;
  color: var(--navy);
  font-size: 20px;
}

#participantsList { margin: 0; }

.participant-pair {
  display: grid;
  grid-template-columns: minmax(150px, 240px) 1fr;
  gap: 4px 24px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}

.participant-pair:last-child { border-bottom: 0; padding-bottom: 0; }

.participant-pair dt { font-weight: 700; color: var(--navy); }

.participant-pair dd { margin: 0; }

@media (max-width: 599px) {
  .participant-pair { grid-template-columns: 1fr; gap: 0; }
}

#thread-actions-bar { margin: 0 0 20px; }

.pending-agreement-banner {
  margin: 0 0 20px;
  padding: 20px var(--card-padding);
  text-align: center;
  color: var(--warning-text);
  background-color: var(--warning-bg-strong);
  border: 2px solid #ffc107;
  border-radius: var(--radius-lg);
}

.pending-agreement-banner h3 {
  margin: 0 0 8px;
  color: var(--warning-text);
  font-size: 20px;
}

.pending-agreement-banner p { margin: 0 0 16px; }

/* The timeline. */
.publication-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 16px;
  margin: 0 0 12px;
  padding: 8px 12px;
  color: var(--text-muted);
  font-size: 0.9em;
  background-color: var(--surface-alt);
  border-radius: var(--radius);
}

.publication-meta .timestamp { font-size: 1.05em; }

.thread-item > p:last-child { margin-bottom: 0; }

.thread-item.countdown-publication {
  background-color: #fffbeb;
  border-left-color: #facc15;
}

.thread-item.countdown-publication.countdown-expired {
  background-color: #fff1f2;
  border-left-color: var(--danger);
}

.countdown-message { white-space: pre-wrap; }

/* The agreement dialog and its page. */
dialog.agreement-dialog {
  width: min(560px, calc(100vw - 2 * var(--gutter)));
  max-width: none;
  max-height: calc(100dvh - 2 * var(--gutter));
  padding: 0;
  color: var(--text);
  background-color: var(--surface);
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

dialog.agreement-dialog::backdrop { background: rgba(10, 18, 34, 0.65); }

.agreement-dialog .agreement-modal-content { padding: var(--card-padding); }

.agreement-modal-content h2 { text-align: center; }

.agreement-terms-box {
  max-height: 220px;
  overflow-y: auto;
  margin: 0 0 16px;
  padding: 14px 16px;
  white-space: pre-wrap;
  background-color: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.agreement-options {
  display: grid;
  gap: 10px;
  margin: 0 0 20px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 12px 14px;
  font-weight: 400;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}

.radio-option:hover { border-color: var(--navy); }

.radio-option input {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--navy);
}

.radio-option:has(input:focus-visible) { box-shadow: var(--focus-ring); }

.radio-option:has(input:checked) {
  border-color: var(--navy);
  background-color: var(--surface-alt);
  font-weight: 700;
  color: var(--navy);
}

/* ——— Forms opened from a process ——— */
.checkbox-group {
  display: grid;
  gap: 8px;
  margin: 0 0 18px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 10px 14px;
  font-weight: 400;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s, border-color 0.15s;
}

.checkbox-label:hover { background-color: var(--surface-hover); }

.checkbox-label input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.checkbox-custom {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: 2px solid #b5bcc6;
  border-radius: 50%;
  transition: background-color 0.15s, border-color 0.15s;
}

.checkbox-custom::after {
  content: "";
  width: 10px;
  height: 5px;
  border-left: 2.5px solid #fff;
  border-bottom: 2.5px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px);
  opacity: 0;
}

.checkbox-label input:checked ~ .checkbox-custom {
  background-color: var(--primary);
  border-color: var(--primary);
}

.checkbox-label input:checked ~ .checkbox-custom::after { opacity: 1; }

.checkbox-label input:focus-visible ~ .checkbox-custom { box-shadow: var(--focus-ring); }

.checkbox-label:has(input:checked) {
  background-color: var(--surface-alt);
  border-color: var(--navy);
  color: var(--navy);
  font-weight: 700;
}

.checkbox-text { min-width: 0; }

.participant-form {
  margin: 0 0 16px;
  padding: 16px;
  background-color: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.participant-form .remove-participant { display: flex; margin-left: auto; }



/* ——— The step-by-step creation form ——— */
.wizard-step-indicator {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  margin: 0 0 20px;
  padding: 4px;
}

.wizard-step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 1 88px;
  min-width: 0;
}

.wizard-step-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 0.85em;
  font-weight: 700;
  color: var(--text-faint);
  background-color: #f5f5f5;
  border: 2px solid #cfd5dd;
  border-radius: 50%;
}

.wizard-step-label {
  margin-top: 6px;
  max-width: 100%;
  font-size: 12px;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: normal;
  color: var(--text-faint);
}

.wizard-step-item.current .wizard-step-circle {
  color: #fff;
  background-color: var(--navy);
  border-color: var(--navy);
  box-shadow: 0 0 0 4px rgba(41, 65, 97, 0.3);
}

.wizard-step-item.current .wizard-step-label { color: var(--navy); font-weight: 700; }

.wizard-step-item.completed .wizard-step-circle {
  color: #fff;
  background-color: var(--primary);
  border-color: var(--primary);
}

.wizard-step-item.completed .wizard-step-label { color: var(--navy); }

.wizard-step-connector {
  flex: 1 1 0;
  min-width: 8px;
  max-width: 40px;
  height: 2px;
  margin-top: 17px;
  background-color: var(--border);
}

.wizard-step-connector.completed { background-color: var(--primary); }

/* When the form is narrow (a phone, a small window) the steps are only
   numbered circles; the step's question says what it is about. */
#create-thread-form-container { container-type: inline-size; }

@container (max-width: 760px) {
  .wizard-step-item { flex: 0 0 auto; }

  .wizard-step-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .wizard-step-circle { width: 28px; height: 28px; font-size: 0.8em; }

  .wizard-step-item.current .wizard-step-circle { box-shadow: 0 0 0 3px rgba(41, 65, 97, 0.3); }

  .wizard-step-connector { min-width: 10px; margin-top: 13px; }
}

.wizard-intro-title { color: var(--navy); }

.wizard-intro-list {
  margin: 14px 0;
  padding-left: 22px;
  list-style: disc;
}

.wizard-intro-list li { margin-bottom: 6px; }

.wizard-intro-ready { font-style: italic; color: var(--text-muted); }

.wizard-step-question { font-weight: 700; }

.uploaded-file-display {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  padding: 8px 8px 8px 14px;
  background-color: var(--success-light);
  border: 1px solid var(--success-border);
  border-radius: var(--radius);
}

.file-success-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  font-size: 0.85em;
  font-weight: 700;
  color: #fff;
  background-color: var(--primary);
  border-radius: 50%;
}

.file-name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.file-remove-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
}

.file-remove-btn:hover {
  background-color: var(--danger-light);
  border-color: var(--danger-border);
}

.file-remove-icon { width: 20px; height: 20px; }

.evidence-file-row { margin-bottom: 16px; }

.evidence-name-label { font-weight: 400; font-size: 14px; color: #555; }

/* ——— Notifications ——— */
.notifications-container { max-width: 800px; }

.notification {
  margin: 0 0 16px;
  padding: var(--card-padding);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.notification.unseen {
  background-color: #faf8f0;
  border-left: 5px solid var(--navy);
}

.notification-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin: 0 0 12px;
}

.notification-header h3 {
  margin: 0;
  font-size: 19px;
  color: var(--text);
}

.unseen-label {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  font-size: 12px;
  border-radius: 10px;
  background-color: var(--navy);
  color: #fff;
  vertical-align: middle;
}

.notification-content { color: #555; }

.notification-thread-link a {
  color: var(--navy);
  font-weight: 700;
  text-decoration: none;
}

.notification-thread-link a:hover { text-decoration: underline; }

.notification-actions {
  display: flex;
  justify-content: flex-end;
}

/* ——— Staff pages ——— */
.page-section { margin-top: 32px; }

.page-section h2 { margin-bottom: 12px; }

.danger-zone {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

.calculator-upload-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
}

.calculator-upload-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.calculator-upload-filename {
  font-weight: 700;
  color: var(--navy);
  overflow-wrap: anywhere;
}

.calculator-upload-actions { width: 240px; }

@media (max-width: 599px) {
  .calculator-upload-actions { width: 100%; }
}

.uploads-pagination {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  max-width: 480px;
  margin: 32px auto 0;
}

#uploads-page-label { white-space: nowrap; }

/* ——— The PDF viewer (dflip) and its bookmarks ——— */
.df-ui-share { display: none !important; }

.bookmark-widget {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 999999;
  font-family: 'Lato', sans-serif;
}

.bookmark-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  color: #fff;
  background: var(--navy);
  border: none;
  border-radius: 50%;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: background 0.2s;
}

.bookmark-toggle:hover,
.bookmark-toggle.active { background: var(--navy-light); }

.bookmark-toggle.active { box-shadow: 0 0 0 3px rgba(41, 65, 97, 0.5), 0 3px 10px rgba(0, 0, 0, 0.35); }

.bookmark-toggle.bookmarked svg {
  color: #fbbf24;
  filter: drop-shadow(0 0 2px rgba(251, 191, 36, 0.5));
}

.bookmark-panel {
  position: absolute;
  top: 52px;
  left: 0;
  display: none;
  flex-direction: column;
  width: min(300px, calc(100vw - 24px));
  max-height: 420px;
  overflow: hidden;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.bookmark-panel.open { display: flex; }

.bookmark-panel-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border-light);
}

.bookmark-panel-title { font-weight: 700; font-size: 0.95em; }

.bookmark-add-row { padding: 8px 12px; }

.bookmark-add-btn {
  display: flex;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 8px 12px;
  font: inherit;
  font-size: 0.88em;
  font-weight: 700;
  color: var(--navy);
  background: transparent;
  border: 2px dashed var(--border-field);
  border-radius: 8px;
  cursor: pointer;
}

.bookmark-add-btn:hover {
  background: var(--surface-alt);
  border-color: var(--navy);
}

.bookmark-form {
  padding: 8px 12px 12px;
  border-bottom: 1px solid var(--border-light);
}

input.bookmark-label-input {
  min-height: 36px;
  margin: 0;
  padding: 6px 10px;
  font-size: 0.9em;
}

input.bookmark-label-input.input-error {
  border-color: var(--danger);
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.bookmark-form-page {
  margin: 6px 0 8px;
  font-size: 0.8em;
  color: #888;
}

.bookmark-form-actions { display: flex; gap: 8px; }

.bookmark-save-btn,
.bookmark-cancel-btn {
  margin: 0;
  padding: 6px 14px;
  font: inherit;
  font-size: 0.85em;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.bookmark-save-btn { color: #fff; background: var(--navy); }
.bookmark-save-btn:hover { background: var(--navy-light); }
.bookmark-save-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.bookmark-cancel-btn { color: #555; background: #eceff3; }
.bookmark-cancel-btn:hover { background: #dfe3e9; }

.bookmark-list {
  flex: 1;
  max-height: 250px;
  margin: 0;
  padding: 4px 0;
  overflow-y: auto;
}

.bookmark-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-left: 3px solid transparent;
}

.bookmark-item:hover { background: #f7f7f7; }

.bookmark-item-current {
  background: var(--surface-alt);
  border-left-color: var(--navy);
}

.bookmark-item-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.bookmark-item-label {
  overflow: hidden;
  font-size: 0.9em;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.bookmark-item-page {
  margin-top: 1px;
  font-size: 0.75em;
  color: var(--text-faint);
}

.bookmark-item-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  margin: 0 0 0 8px;
  padding: 0;
  font-size: 1.2em;
  font-weight: 700;
  color: #bbb;
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.bookmark-item-delete:hover {
  color: var(--danger);
  background: var(--danger-light);
}

.bookmark-empty {
  padding: 20px 16px;
  text-align: center;
  font-size: 0.88em;
  font-style: italic;
  color: #aaa;
}
