/* External website — single small stylesheet (English, dark theme,
   indigo primary like the main app; buttons carry meaning by color). */

:root {
  --bg: #0f1220;
  --card: #1a1e33;
  --line: #2c3355;
  --text: #eef0ff;
  --muted: #9aa3c7;
  --indigo: #4f46e5;
  --indigo-hover: #4338ca;
  --green: #16a34a;
  --red: #dc2626;
  --yellow: #ca8a04;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}
a { color: #a5b4fc; }

.page { max-width: 720px; margin: 0 auto; padding: 24px 16px 48px; }
.page-wide { max-width: 1100px; }

.home-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  text-align: center;
}
.home-page h1 { margin: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}
.card-title { margin: 0 0 8px; font-size: 1.4rem; }
.card-sub { margin: 4px 0; color: var(--muted); }
.ext-event-header { text-align: center; }
.empty {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 32px 20px;
  text-align: center;
  color: var(--muted);
}

.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; }
/* Required-field star (owner, 2026-11-04): red, so required fields
   stand out from optional ones at a glance. */
.req-star { color: var(--red); }
/* Yes/No toggle buttons (owner, 2026-11-04): replace the Yes/No
   dropdowns. The tapped button reads as the answer. */
.yn-group { display: flex; gap: 8px; }
/* Vertical option lists (owner, 2026-11-05): requirement choices stack
   one per row so long option text wraps instead of breaking the layout
   in a horizontal row. Gates (Yes/No, company type) stay horizontal. */
.yn-group.yn-vertical { flex-direction: column; }
.yn-group.yn-vertical .yn-btn { text-align: left; }
.yn-btn {
  padding: 8px 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
}
.yn-btn.selected { background: var(--indigo); border-color: var(--indigo); color: #fff; }
/* Single-choice tick (owner, 2026-11-04): the selected button also
   carries a tick mark, so the choice reads at a glance. */
.yn-btn.selected::before { content: "✓"; margin-right: 6px; }
.input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #12152a;
  color: var(--text);
  font-size: 1rem;
}
.file-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.file-input-row .input { min-width: 0; }
.file-preview {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.file-remove {
  flex: 0 0 auto;
  padding: 8px 12px;
  background: var(--red);
  color: #fff;
}
.file-remove[hidden] { display: none; }
.file-remove:hover { background: #b91c1c; }
.checkbox { display: flex; gap: 8px; align-items: center; font-weight: 400; }

.btn {
  display: inline-block;
  padding: 10px 20px;
  border: 0;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn-primary { background: var(--indigo); color: #fff; }
.btn-primary:hover { background: var(--indigo-hover); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn-green { background: var(--green); color: #fff; }
.btn:disabled { opacity: 0.55; cursor: default; }

/* Centered form bottoms (main app global rule). */
.form-actions { display: flex; gap: 8px; margin-top: 8px; justify-content: center; }

/* Found step: name on the left, alternate-registration button top-right. */
.ext-found-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.ext-found-head .btn { margin-left: auto; white-space: nowrap; }
.ext-found-head .btn-ghost {
  background: var(--indigo);
  border-color: var(--indigo);
}
.ext-found-head .btn-ghost:hover { background: var(--indigo-hover); }

@media (max-width: 600px) {
  .ext-found-head { flex-direction: column; }
  .ext-found-head .card-sub { order: 1; }
  .ext-found-head .btn {
    order: 0;
    width: auto;
    margin-left: auto;
  }
}

/* Task cards (owner, 2026-11-16): same layout as the main site's
   user event card — a bold day header, then one card per task with
   the name + time on the left and the status on the right. The right
   side is the action side: the status pill and the View pill sit on
   one line, the View pill carrying the same pill shape in indigo;
   under them the submitted value when there is one, or the upload
   control when not. A submitted task shows only Resubmit; clicking
   it swaps the view for the upload control in that same place. */
.task-card { margin-bottom: 12px; padding: 16px; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18); }
.task-card__day { font-weight: 700; font-size: 0.95rem; margin: 16px 0 8px; }
.task-card__day:first-child { margin-top: 0; }
.task-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.task-card__details { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.task-card__name { font-size: 1.05rem; }
.task-card__status { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; margin-left: auto; flex: 0 1 340px; min-width: 0; }
.task-card__pill-row { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.task-card__view { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.task-card__value { color: var(--muted); overflow-wrap: anywhere; text-align: right; }
.task-card__picture-link { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.85rem; background: var(--indigo); color: #fff; text-decoration: none; white-space: nowrap; border: 0; cursor: pointer; font: inherit; }
.task-card__picture-link:hover { background: var(--indigo-hover); }
.task-card__form { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.task-card__control { width: 100%; }
.task-card__actions { display: flex; justify-content: flex-end; gap: 8px; }
.task-card__note { margin: 0; color: var(--muted); font-size: 0.9rem; text-align: right; }
.task-card__hidden { display: none !important; }
.task-meta { color: var(--muted); font-size: 0.9rem; margin: 2px 0; }
.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  background: #2c3355;
  color: var(--muted);
  white-space: nowrap;
}
.pill-done { background: #14532d; color: #bbf7d0; }
.pill-review { background: #713f12; color: #fde68a; }

/* Mobile (owner, 2026-11-16): the pills sit at the top-right of the
   card, beside the task name, instead of below it — the status
   column and the view wrapper dissolve (display: contents) so the
   pill row becomes a head item, while the upload control, value,
   note and buttons each take a full row below. No font is shrunk:
   the pills fit beside a short name, and a long name wraps them
   below on their own line instead of overlapping. */
@media (max-width: 420px) {
  .task-card__head { flex-direction: row; flex-wrap: wrap; }
  .task-card__status, .task-card__view { display: contents; }
  .task-card__details { flex: 1 1 auto; }
  .task-card__pill-row { flex: 0 0 auto; margin-left: auto; }
  .task-card__status > .pill { flex: 0 0 auto; margin-left: auto; }
  .task-card__status > .task-card__value,
  .task-card__view > .task-card__value,
  .task-card__status > .task-card__note,
  .task-card__status > .task-card__actions,
  .task-card__form { flex: 1 1 100%; }
}

table { width: 100%; border-collapse: collapse; }

/* Shared-details table (owner screenshot, 2026-11-04): with many
   columns the table squeezed and wrapped values mid-date instead of
   showing all data. Columns now keep their natural width and the
   table scrolls sideways inside the card. */
.table-scroll { overflow-x: auto; }
.table-scroll table { width: max-content; min-width: 100%; }
.table-scroll th, .table-scroll td { white-space: nowrap; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 0.9rem; }

/* Shared-details page (owner, 2026-11-04): the table uses the full
   page width so more columns show without scrolling. */
.page.userdata-page { max-width: none; }

/* Document thumbnails in the shared table (owner, 2026-11-04), with
   a centered view popup for the full image. */
/* Small enough to fit the table row (owner, 2026-11-04): the popup,
   not the thumbnail, is for viewing the image at full size. */
.doc-thumb {
  width: 24px;
  height: 24px;
  object-fit: cover;
  border-radius: 4px;
  cursor: zoom-in;
  vertical-align: middle;
}
#img-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
}
#img-lightbox[hidden] { display: none; }
#img-lightbox img {
  /* A comfortable viewing size, not full screen: at most 720px wide
     (80% of the screen on narrow screens) and 75% of screen height. */
  max-width: min(720px, 80vw);
  max-height: 75vh;
  border-radius: 12px;
}
#img-lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

/* Toasts sit in the middle of the screen (owner, 2026-11-04),
   not at the bottom edge. Text is centred, larger and bolder
   (owner, 2026-11-23), so the message reads at a glance on a phone. */
#toasts {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
}
.toast {
  background: #22264a;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 14px 20px;
  max-width: 90vw;
  min-width: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  font-size: 1.125rem;
  font-weight: 600;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}
.toast-error { border-color: var(--red); }
.toast-success { border-color: var(--green); }
/* Error toasts stay until dismissed (owner, 2026-11-19). */
.toast-close {
  background: none;
  border: 0;
  color: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  flex: none;
}

/* Upload progress (owner, 2026-11-22): the progress lives ONLY in
   this centred box — never on the Submit or Register button. Same
   centre position as the toasts, above them so it stays visible
   without scrolling; a thin indigo bar under the text. */
#upload-progress {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 250;
  background: #22264a;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 18px;
  max-width: 90vw;
  min-width: 260px;
  text-align: center;
}
.upload-progress-text { font-weight: 600; }
.upload-progress-bar {
  height: 6px;
  margin-top: 10px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
}
.upload-progress-fill {
  height: 100%;
  width: 0;
  background: var(--indigo);
  border-radius: 3px;
}

/* Submitting-data spinner (owner, 2026-11-04): the owner's spiral GIF
   as a full-screen overlay, shown by apiFetch while a submit is in
   flight unless the call passes { spinner: false }. The [hidden] rule
   must stay: the flex display below would otherwise override the
   hidden attribute and the overlay could never hide again. */
.ext-processing-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
}
.ext-processing-overlay[hidden] { display: none; }
/* Spiral size (owner, 2026-11-04): 148px, the main app's desktop
   spinner size — the old 96px looked very small on the page. */
.ext-processing-spiral {
  width: 148px;
  height: 148px;
  background: url('../img/spiral.gif') center / contain no-repeat;
}

/* External API registration popup (owner, 2026-11-14): the outside
   registration runs while the visitor waits; failure keeps it open
   with the error instead of saving anything here. */
.api-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.6);
}
.api-popup-box {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  max-width: min(420px, 90vw);
  text-align: center;
}
.api-popup-box .ext-processing-spiral {
  width: 96px;
  height: 96px;
  margin: 0 auto;
}
.api-popup-text { margin: 16px 0; }
/* "Add credential" (owner, 2026-11-14): the error popup's second
   button sits beside Close, and the credential popup's fields
   left-align inside the centered box. */
.api-popup-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }
.api-popup-form { text-align: left; margin: 16px 0 0; }
.api-popup-form .form-group { margin-bottom: 12px; }

/* Userdata table filters (owner, 2026-11-18): mirror-style search +
   per-column tick-box filters on the shared registrations table.
   Dark theme, same card/line/indigo tokens as the rest of the page. */

/* Userdata header (owner, 2026-11-19): one clean line like the main
   site — title + Invite By + totals centered together as one group
   on the plain page background (no card box), like the centered
   search row below it. Wraps on narrow screens, stays centered.
   The meta line keeps the brighter/bolder look from 2026-11-18
   (body-text color, slightly larger, weight 600). */
.userdata-head {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 24px;
  margin-bottom: 16px;
}
.userdata-head-title { margin: 0; font-size: 1.4rem; }
.userdata-head-meta { margin: 0; color: var(--text); font-size: 1.05rem; font-weight: 600; }
.userdata-filter-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
/* Centered search + count group (owner, 2026-11-18): same centered
   row as the main site — this page has no Export button, so the
   group takes the full row width. Wraps gracefully on narrow
   screens. */
.userdata-filter-group {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.userdata-filter-search {
  flex: 1 1 240px;
  max-width: 360px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.userdata-filter-search::placeholder { color: var(--muted); }
.userdata-filter-count {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}
.userdata-filter-head {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.userdata-filter-btn {
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  line-height: 1.4;
  cursor: pointer;
}
.userdata-filter-btn:hover { border-color: var(--indigo); color: var(--text); }
.userdata-filter-btn.is-active {
  background: var(--indigo);
  border-color: var(--indigo);
  color: #fff;
}
.userdata-filter-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 40;
  min-width: 180px;
  max-width: 280px;
  max-height: 260px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  text-align: left;
}
.userdata-filter-menu[hidden] { display: none; }
.userdata-filter-menu label {
  display: block;
  padding: 3px 4px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 400;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.userdata-filter-menu label:hover {
  background: rgba(79, 70, 229, 0.2);
  border-radius: 4px;
}
.userdata-filter-menu input { margin-right: 6px; }
.userdata-filter-clear {
  display: block;
  margin: 6px 0 0 auto;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.userdata-filter-clear:hover { border-color: var(--indigo); color: var(--text); }
.userdata-filter-empty td {
  text-align: center;
  color: var(--muted);
  padding: 24px 10px;
}
