/*
  Britepods stock: the one stylesheet. Hand-written, no build step.
  Phone first: everything fits a narrow screen, and wider screens just get more margin.
*/

:root {
  --text: #1a1a1a;
  --muted: #5c5c5c;
  --background: #ffffff;
  --line: #d9d9d9;
  --brand: #0b5cad;
  --local-banner: #ffd400; /* yellow: Tom's Mac */
  --test-banner: #c40000; /* red: the test system */
  --danger: #b00020;
  --success-background: #e7f5ea;
  --warning-background: #fff4d6;
  --error-background: #fde8ea;
  --info-background: #e8f0fb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--background);
}

/* Which copy of the system this is (none on live). */
.env-banner {
  padding: 0.5rem 1rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.03em;
}

.env-banner-local {
  background: var(--local-banner);
  color: #000000;
}

.env-banner-test {
  background: var(--test-banner);
  color: #ffffff;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
}

.site-user {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.site-name {
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
}

.page {
  max-width: 60rem;
  margin: 0 auto;
  padding: 1rem;
}

h1 {
  font-size: 1.5rem;
  margin: 0.5rem 0 1rem;
}

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

.site-footer {
  padding: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

/* ------------------------------------------------------------------------
   Messages ("Signed in", "Re-sign-in with your code first" ...)
   ------------------------------------------------------------------------ */

.messages {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.message {
  margin: 0 0 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  background: var(--info-background);
}

.message-success {
  background: var(--success-background);
}

.message-warning {
  background: var(--warning-background);
}

.message-error {
  background: var(--error-background);
}

/* ------------------------------------------------------------------------
   Forms and buttons (also used by the sign-in and two-step pages)
   ------------------------------------------------------------------------ */

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select,
textarea {
  width: 100%;
  max-width: 28rem;
  padding: 0.6rem;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.375rem;
}

button,
.button {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  background: var(--brand);
  border: 0;
  border-radius: 0.375rem;
  text-decoration: none;
  cursor: pointer;
}

.button-secondary {
  color: var(--brand);
  background: transparent;
  border: 1px solid var(--brand);
}

.button-danger {
  background: var(--danger);
}

.button-small {
  padding: 0.3rem 0.7rem;
  font-size: 0.875rem;
}

/* A button that looks like a link (the "Sign out" button in the header). */
.button-link {
  padding: 0;
  color: var(--brand);
  background: none;
  font-weight: 400;
  text-decoration: underline;
}

.inline-form {
  display: inline;
}

.stacked-form p {
  margin: 0 0 1rem;
}

.link-list li {
  margin-bottom: 0.5rem;
}

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

/* A wide table scrolls sideways inside its box on a phone, instead of widening the page. */
.table-scroll {
  overflow-x: auto;
}

.table th,
.table td {
  padding: 0.5rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

/* ------------------------------------------------------------------------
   The factory station (design 6.1): big text and big buttons
   ------------------------------------------------------------------------ */

body.station {
  font-size: 1.25rem;
}

body.station h1 {
  font-size: 2rem;
}

.keyed-by-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--info-background);
  border-bottom: 1px solid var(--line);
}

.big-choice {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.75rem;
}

.button-big {
  min-height: 4rem;
  padding: 1rem;
  font-size: 1.35rem;
  text-align: center;
}

.button-current {
  outline: 4px solid var(--local-banner);
}

/* The station home's area for the capture buttons (they arrive in Phase 1). */
.station-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

/* ------------------------------------------------------------------------
   Uploads (step 0.5): "Upload a scan" and "Recent uploads"
   ------------------------------------------------------------------------ */

/* The kind picker: one big tappable row per kind. */
.kind-choice {
  margin: 0 0 1rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.375rem;
}

.kind-choice legend {
  font-weight: 600;
}

.kind-option {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.35rem 0;
  font-weight: 400;
}

body.station .kind-option input[type="radio"] {
  width: 1.4rem;
  height: 1.4rem;
}

input[type="file"] {
  display: block;
  max-width: 100%;
  padding: 0.5rem 0;
  font-size: 1rem;
}

/* At the station the file chooser is a big target, like the other buttons there. */
body.station input[type="file"] {
  width: 100%;
  padding: 1rem;
  font-size: 1.25rem;
  border: 2px dashed var(--line);
  border-radius: 0.375rem;
}

body.station input[type="file"]::file-selector-button {
  min-height: 3.5rem;
  margin-right: 1rem;
  padding: 0.75rem 1.25rem;
  font-size: 1.25rem;
}

.field-error {
  display: block;
}

/* A SHA-256 fingerprint: 64 characters, which may wrap on a phone. */
.fingerprint {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  word-break: break-all;
}

/* On a phone, each upload is shown as a small card (one line per column, its name in
   front), so the fingerprint gets the full width instead of a narrow column. */
@media (max-width: 40rem) {
  .uploads-table thead {
    display: none;
  }

  .uploads-table tr {
    display: block;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--line);
  }

  .uploads-table td {
    display: block;
    padding: 0.25rem 0;
    border-bottom: none;
  }

  .uploads-table td::before {
    content: attr(data-label) ": ";
    font-weight: 600;
  }
}

/* ------------------------------------------------------------------------
   Printer tests (step 0.6): the A4 test page and the test label
   ------------------------------------------------------------------------ */

.print-section {
  margin: 0 0 2rem;
}

.reprint-fields {
  margin: 0 0 1rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.375rem;
}

.reprint-fields input[type="number"] {
  width: 5rem;
}

.print-form input[type="number"] {
  max-width: 6rem;
}

.print-form input[type="text"] {
  width: 100%;
  max-width: 30rem;
}

.print-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* What zebra.js says: looking for the printer, PRINTED, or why nothing was printed. */
.zebra-status {
  font-weight: 600;
}

/* The Backup log (step 0.7): an error of several lines keeps its line breaks. */
.preserve-lines {
  white-space: pre-line;
  overflow-wrap: anywhere;
}
