/*
 * Puente admin stylesheet.
 *
 * Hand-written and served static. There is deliberately no Vite, Tailwind or npm
 * build step: the production VPS needs nothing but PHP, deployment has no build
 * stage that can fail, and whoever inherits this can change a colour without
 * first reconstructing a toolchain.
 *
 * The visual language follows LinkedIn: a warm grey page, white cards with soft
 * borders, pill-shaped buttons and a single confident blue. It is chosen for a
 * reason beyond taste. The only person who uses this screen is not technical,
 * and a layout she already recognises from somewhere else costs her nothing to
 * learn.
 */

:root {
  /* Warm grey, not cool. This is the single biggest tell of the look. */
  --bg: #f4f2ee;
  --surface: #ffffff;
  --surface-sunk: #f8fafd;

  --ink: rgba(0, 0, 0, 0.9);
  --ink-soft: rgba(0, 0, 0, 0.6);
  --ink-faint: rgba(0, 0, 0, 0.45);

  --line: rgba(0, 0, 0, 0.09);
  --line-soft: rgba(0, 0, 0, 0.06);

  --blue: #0a66c2;
  --blue-dark: #004182;
  --blue-wash: rgba(10, 102, 194, 0.08);

  --good: #057642;
  --good-wash: #e9f5ef;
  --warn: #915907;
  --warn-wash: #fdf3e3;
  --bad: #b24020;
  --bad-wash: #fdefeb;

  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 0 0 1px rgba(0, 0, 0, 0.02), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lift: 0 0 0 1px rgba(0, 0, 0, 0.02), 0 4px 12px rgba(0, 0, 0, 0.1);

  --mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============ top bar ============ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.06);
}

.topbar-inner {
  max-width: 1128px;
  margin: 0 auto;
  padding: 0 20px;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 17px;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin-right: 12px;
}

.brand:hover { text-decoration: none; }

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  flex: none;
}

.brand-sub {
  font-weight: 400;
  font-size: 13px;
  color: var(--ink-faint);
}

.topnav {
  display: flex;
  align-items: stretch;
  gap: 4px;
  flex: 1;
  height: 100%;
}

.topnav a {
  display: flex;
  align-items: center;
  padding: 0 14px;
  color: var(--ink-soft);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.topnav a:hover { color: var(--ink); text-decoration: none; }
.topnav a.active { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 13px;
}

/* Language switcher. Quiet by design: Spanish is the default and the client
   never needs to touch it. */
.locale-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.locale-switch a {
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
}

.locale-switch a:hover { background: rgba(0, 0, 0, 0.04); color: var(--ink); text-decoration: none; }
.locale-switch a.active { background: var(--blue); color: #fff; }

/* ============ shell ============ */

.wrap {
  max-width: 1128px;
  margin: 0 auto;
  padding: 22px 20px 90px;
}

.wrap-narrow { max-width: 780px; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 3px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.page-sub { color: var(--ink-soft); margin: 0; }

.back-link {
  display: inline-block;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 10px;
}

/* ============ cards ============ */

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}

.card-head {
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--line-soft);
}

/* Header without the hairline rule under it, for cards whose first element is a
   search box rather than a title. This was once called "plain", which collided
   with a global .plain used by the participant holding page and silently pulled
   a 440px max-width and 96px margins into the middle of the admin lists. Keep
   card modifiers specific enough that they cannot match anything else. */
.card-head.bare { border-bottom: none; }

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

.card-sub {
  color: var(--ink-soft);
  margin: 5px 0 0;
  font-size: 13.5px;
}

.card-body { padding: 18px 20px; }
.card-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface-sunk);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ============ list rows ============ */

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

.list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line-soft);
}

.list-row:last-child { border-bottom: none; }
.list-row.linkable:hover { background: var(--surface-sunk); }

.list-main { flex: 1; min-width: 0; }

.list-title {
  font-weight: 600;
  font-size: 15px;
  margin: 0 0 2px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.list-title a { color: var(--ink); }
.list-title a:hover { color: var(--blue); }

.list-sub {
  color: var(--ink-soft);
  font-size: 13px;
  margin: 0;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.list-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* The creation date as its own column. She scans this list newest first to find
   a job, so the date needs to sit in a fixed place her eye can run down, not
   inline among the other details. */
.list-date {
  flex: none;
  width: 92px;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.list-date-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  font-weight: 600;
}

.list-date-value { font-size: 13.5px; color: var(--ink); font-variant-numeric: tabular-nums; }

/* Circular code badge. Reads as an avatar, which is the point. */
.badge-code {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--blue-wash);
  color: var(--blue);
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  flex: none;
}

.badge-code.muted { background: rgba(0, 0, 0, 0.05); color: var(--ink-faint); }

/* ============ buttons ============ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.12s ease, box-shadow 0.12s ease, color 0.12s ease;
}

.btn:hover { text-decoration: none; }

.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); color: #fff; }

.btn-outline {
  border-color: var(--blue);
  color: var(--blue);
  /* Thicken on hover without shifting layout. */
  box-shadow: inset 0 0 0 0 var(--blue);
}
.btn-outline:hover { background: var(--blue-wash); box-shadow: inset 0 0 0 1px var(--blue); color: var(--blue); }

.btn-ghost { border-color: rgba(0, 0, 0, 0.25); color: var(--ink-soft); }
.btn-ghost:hover { background: rgba(0, 0, 0, 0.05); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35); color: var(--ink); }

.btn-sm { height: 28px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* Participant-facing. Larger because it is the only thing on the page and is
   very often tapped with a thumb on a phone. */
.btn-lg { height: 46px; padding: 0 28px; font-size: 16px; }

.btn[disabled] { opacity: 0.5; cursor: default; }

.btn-link {
  height: auto;
  padding: 0;
  border: none;
  color: var(--blue);
  font-weight: 600;
}
.btn-link:hover { background: none; text-decoration: underline; }

/* ============ chips ============ */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.7;
}

.chip-good { background: var(--good-wash); color: var(--good); }
.chip-warn { background: var(--warn-wash); color: var(--warn); }
.chip-bad { background: var(--bad-wash); color: var(--bad); }
.chip-off { background: rgba(0, 0, 0, 0.05); color: var(--ink-soft); }
.chip-info { background: var(--blue-wash); color: var(--blue); }

.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

/* ============ forms ============ */

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }

label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 5px;
}

input[type=text], input[type=email], input[type=password], input[type=number],
textarea, select {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
}

input:hover, textarea:hover, select:hover { background: var(--surface-sunk); }

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue);
  background: var(--surface);
}

input.mono, textarea.mono { font-family: var(--mono); font-size: 13px; }

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

input[disabled] { background: rgba(0, 0, 0, 0.04); color: var(--ink-faint); }

.field-note { color: var(--ink-soft); font-size: 12.5px; margin: 5px 0 0; }

.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > * { flex: 1 1 220px; min-width: 0; }
.row > .narrow { flex: 0 0 150px; }
.row > .medium { flex: 0 0 240px; }

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
}

.check:hover { background: var(--surface-sunk); }
.check input { margin: 3px 0 0; flex: none; width: 16px; height: 16px; }
.check label { margin: 0; font-weight: 500; color: var(--ink); cursor: pointer; font-size: 14px; }
.check .field-note { margin-top: 2px; }

/* ============ search ============ */

.search-wrap { position: relative; margin-bottom: 14px; }

.search {
  width: 100%;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  background: var(--surface);
  font: inherit;
}

.search:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue);
}

/* ============ copy blocks ============ */

.copy-item { margin-bottom: 14px; }
.copy-item:last-child { margin-bottom: 0; }

.copy-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 5px;
  flex-wrap: wrap;
}

.copy-label .muted { font-weight: 400; color: var(--ink-faint); font-size: 12.5px; }

.copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 8px 8px 13px;
}

.copy-row code {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 12.5px;
  word-break: break-all;
  color: var(--ink);
}

/* ============ notices ============ */

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13.5px;
  box-shadow: var(--shadow);
  background: var(--surface);
}

.notice strong { font-weight: 600; }
.notice-good { background: var(--good-wash); color: var(--good); }
.notice-warn { background: var(--warn-wash); color: var(--warn); }
.notice-bad { background: var(--bad-wash); color: var(--bad); }
.notice-info { background: var(--blue-wash); color: var(--blue-dark); }

.notice ul { margin: 6px 0 0; padding-left: 18px; }
.notice li { margin-bottom: 2px; }

/* ============ empty states ============ */

.empty { padding: 44px 24px; text-align: center; }
.empty-mark {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--blue-wash);
  color: var(--blue);
  display: grid; place-items: center;
  font-size: 22px; font-weight: 700;
  margin: 0 auto 12px;
}
.empty-title { font-weight: 600; font-size: 15px; margin: 0 0 4px; }
.empty-text { color: var(--ink-soft); margin: 0 auto 16px; max-width: 380px; }

/* ============ stat strip ============ */

.stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.stat {
  flex: 1 1 150px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}

.stat-value { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.stat-label { color: var(--ink-soft); font-size: 12.5px; margin-top: 2px; }

/* ============ misc ============ */

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

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 4px;
}
.divider { height: 1px; background: var(--line-soft); margin: 16px 0; }
.stack > * + * { margin-top: 14px; }
.inline-form { display: inline; }

.panel-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.panel-block:last-child { margin-bottom: 0; }
.panel-block.is-paused { background: var(--surface-sunk); }

.panel-block-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

/* ============ login ============ */

.login-shell { max-width: 392px; margin: 72px auto; padding: 0 20px; }
.login-brand { text-align: center; margin-bottom: 20px; }
.login-brand .brand-mark { margin: 0 auto 10px; width: 44px; height: 44px; font-size: 20px; border-radius: 10px; }
.login-brand h1 { font-size: 26px; font-weight: 600; margin: 0; letter-spacing: -0.02em; }
.login-brand p { color: var(--ink-soft); margin: 2px 0 0; }
.login-shell .card { box-shadow: var(--shadow-lift); }

/* ============ participant holding page ============ */

/* Scoped name. This used to be `.plain`, which is generic enough that it also
   matched a card-header modifier and dragged a 440px max-width and 96px margins
   into the middle of the admin screens. */
.standalone { max-width: 440px; margin: 96px auto; padding: 0 24px; text-align: center; }
.standalone h1 { font-size: 20px; font-weight: 600; margin: 0 0 8px; }
.standalone p { color: var(--ink-soft); margin: 0; }

/* The client's own welcome wording. Left-aligned even though the page is
   centred, because it can run to several sentences and centred prose is hard to
   read on a phone. */
.welcome-text {
  text-align: left;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  margin-bottom: 28px;
}

/* ============ responsive ============ */

@media (max-width: 720px) {
  .topbar-inner { height: 50px; padding: 0 14px; }
  .brand-sub { display: none; }
  .topbar-user span { display: none; }
  .wrap { padding: 16px 14px 70px; }
  .page-title { font-size: 19px; }

  .list-row { flex-wrap: wrap; gap: 10px; padding: 14px; }
  .list-meta { width: 100%; justify-content: flex-start; padding-left: 56px; }

  .card-body, .card-head { padding-left: 14px; padding-right: 14px; }
  .card-foot { padding-left: 14px; padding-right: 14px; }

  .copy-row { flex-wrap: wrap; }
  .copy-row code { flex-basis: 100%; }

  .row > .narrow, .row > .medium { flex: 1 1 100%; }
}
