/* Inter is the spec's typeface (3.1); no font file is bundled, so use it when installed and
   fall back to the closest system sans-serifs. */
:root {
  --bg: #ecece8; /* spec 4.3 / 7.6 */
  --ink: #111111;
  --muted: #444444;
  --line: #111111;
  --danger: #a10000;
}

* { box-sizing: border-box; }

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

/* Login / denied: centred, nothing else on the page */
.center {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}
.wordmark { font-size: 56px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.subtitle { font-size: 20px; color: var(--muted); margin: 8px 0 40px; }

.btn {
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 14px 28px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { background: #333; }
.btn.secondary { background: transparent; color: var(--ink); }
.btn.small { padding: 6px 12px; font-size: 15px; }

/* Signed-in shell */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 2px solid var(--line);
}
.topbar .brand { font-weight: 700; font-size: 22px; text-decoration: none; color: inherit; }
.topbar .who { display: flex; gap: 16px; align-items: center; }
.topbar form { margin: 0; }
main { padding: 32px; }
main.admin { min-width: 1280px; } /* spec 7.3a: Admin UI desktop-first, min 1280px */

table { border-collapse: collapse; width: 100%; background: #fff; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #ccc; }
th { border-bottom: 2px solid var(--line); }
tr.inactive td { color: #777; }
tr[draggable="true"] { cursor: grab; }
tr[draggable="true"].dragging { opacity: 0.5; }
td.drag-handle { width: 1%; white-space: nowrap; color: #999; letter-spacing: -2px; }
select, input[type="email"], input[type="text"], input[type="number"], textarea {
  font: inherit; padding: 8px; border: 2px solid var(--line); border-radius: 6px; background: #fff;
}
.add-form { display: flex; gap: 12px; margin: 24px 0; align-items: center; }
.add-form input[type="email"] { min-width: 320px; }
.error { color: var(--danger); font-weight: 600; min-height: 1.4em; }

/* Google's standard "Sign in with Google" button (Google Identity branding assets), unmodified. */
.gsi-material-button {
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -webkit-appearance: none;
  background-color: WHITE;
  background-image: none;
  border: 1px solid #747775;
  -webkit-border-radius: 20px;
  border-radius: 20px;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  color: #1f1f1f;
  cursor: pointer;
  font-family: 'Roboto', arial, sans-serif;
  font-size: 14px;
  height: 40px;
  letter-spacing: 0.25px;
  outline: none;
  overflow: hidden;
  padding: 0 12px;
  position: relative;
  text-align: center;
  -webkit-transition: background-color .218s, border-color .218s, box-shadow .218s;
  transition: background-color .218s, border-color .218s, box-shadow .218s;
  vertical-align: middle;
  white-space: nowrap;
  width: auto;
  max-width: 400px;
  min-width: min-content;
}

.gsi-material-button .gsi-material-button-icon {
  height: 20px;
  margin-right: 10px;
  min-width: 20px;
  width: 20px;
}

.gsi-material-button .gsi-material-button-content-wrapper {
  -webkit-align-items: center;
  align-items: center;
  display: flex;
  -webkit-flex-direction: row;
  flex-direction: row;
  -webkit-flex-wrap: nowrap;
  flex-wrap: nowrap;
  height: 100%;
  justify-content: space-between;
  position: relative;
  width: 100%;
}

.gsi-material-button .gsi-material-button-contents {
  -webkit-flex-grow: 1;
  flex-grow: 1;
  font-family: 'Roboto', arial, sans-serif;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
}

.gsi-material-button .gsi-material-button-state {
  -webkit-transition: opacity .218s;
  transition: opacity .218s;
  bottom: 0;
  left: 0;
  opacity: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.gsi-material-button:disabled {
  cursor: default;
  background-color: #ffffff61;
  border-color: #1f1f1f1f;
}

.gsi-material-button:disabled .gsi-material-button-contents {
  opacity: 38%;
}

.gsi-material-button:disabled .gsi-material-button-icon {
  opacity: 38%;
}

.gsi-material-button:not(:disabled):active .gsi-material-button-state,
.gsi-material-button:not(:disabled):focus .gsi-material-button-state {
  background-color: #303030;
  opacity: 12%;
}

.gsi-material-button:not(:disabled):hover {
  -webkit-box-shadow: 0 1px 2px 0 rgba(60, 64, 67, .30), 0 1px 3px 1px rgba(60, 64, 67, .15);
  box-shadow: 0 1px 2px 0 rgba(60, 64, 67, .30), 0 1px 3px 1px rgba(60, 64, 67, .15);
}

.gsi-material-button:not(:disabled):hover .gsi-material-button-state {
  background-color: #303030;
  opacity: 8%;
}

/* Wrapper form: a GET form navigates to /auth/google without JS (CSP forbids inline script) */
.gsi-form { margin: 0; }
/* replaces Google's inline styles, which our CSP (no inline style) would block */
.gsi-svg { display: block; }
.gsi-hidden { display: none; }

/* Operator UI (spec 7.3a: tablet-first, minimum 768px — a separate surface from Admin's
   desktop-first 1280px). High-contrast, large tap targets for factory floor use (spec 7.6). */
main.operator { min-width: 768px; max-width: 640px; margin: 0 auto; }

main.operator label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  margin-bottom: 16px;
}
main.operator select,
main.operator input[type="number"],
main.operator textarea {
  font-size: 18px;
  padding: 14px;
}

.btn-start, .btn-end, .btn-pass, .btn-fail {
  font-size: 20px;
  padding: 18px 24px;
  width: 100%;
}
.btn-start { background: var(--ink); }
.btn-pass { background: #1a7a1a; border-color: #1a7a1a; }
.btn-pass:hover { background: #156015; }
.btn-fail { background: var(--danger); border-color: var(--danger); }
.btn-fail:hover { background: #7a0000; }
.btn-end { background: var(--ink); }

.session-info { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 16px 0 24px; }
.session-info dt { font-weight: 600; color: var(--muted); }
.session-info dd { margin: 0; }

.tally { display: flex; gap: 24px; font-size: 24px; font-weight: 700; margin-bottom: 24px; }
.tally-pass { color: #1a7a1a; }
.tally-fail { color: var(--danger); }

.session-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.session-buttons a.btn { text-align: center; }

/* Fail Reason modal (Change Request: Fail Reason as a Blocking Modal). Deliberately no
   `display` rule here — the browser's native open/close state (via .showModal()/.close())
   controls that; an author-stylesheet `display` override is exactly what broke the previous
   hidden-<div> approach (it beat the UA stylesheet's [hidden] rule). */
dialog.fail-reason-modal {
  border: none;
  border-radius: 8px;
  padding: 24px;
  width: min(90vw, 420px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
dialog.fail-reason-modal::backdrop { background: rgba(17, 17, 17, 0.5); }
dialog.fail-reason-modal textarea { width: 100%; box-sizing: border-box; }
dialog.fail-reason-modal .btn { margin-top: 12px; width: 100%; }

/* Persistent language toggle (spec 7.5) — global chrome on every Operator screen. */
.lang-toggle { display: flex; align-items: center; gap: 6px; font-size: 15px; }
.lang-toggle button {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  padding: 2px 4px;
}
.lang-toggle button.active { color: var(--ink); font-weight: 700; text-decoration: underline; }
.lang-toggle span { color: var(--muted); }

/* Cross-navigation between Admin config screens, shared via _admin_nav.html. */
.admin-nav { display: flex; gap: 16px; margin-bottom: 24px; border-bottom: 1px solid #ccc; padding-bottom: 12px; }
.admin-nav a { color: var(--muted); text-decoration: none; font-weight: 600; }
.admin-nav a:hover { color: var(--ink); }
.admin-nav a.active { color: var(--ink); text-decoration: underline; }

/* Setup screen's read-only SKU display (Change Request: Station-Owned Product Line). */
.sku-display { margin: -10px 0 18px; font-size: 18px; font-weight: 600; }

/* Admin "View Events" screen (Change Request: View Events). */
.archived-tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: #e8e8e4;
  border-radius: 4px;
  padding: 1px 6px;
}
.pagination { display: flex; align-items: center; gap: 16px; margin-top: 16px; }
tr.drilldown td { background: #f5f5f2; padding: 12px 24px; }
tr.drilldown table { background: #fff; }
