:root {
  color-scheme: light dark;
  --gap: 1rem;
  --border: #ccc;
  --success: #1a7f37;
  --error: #c0392b;
  --muted: #666;
  --normal: #1a7f37;
  --attention: #b8860b;
  --priority: #c0392b;
}

* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, sans-serif;
  margin: 0;
  padding: 0 var(--gap) var(--gap);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--gap);
  padding: var(--gap) 0;
  border-bottom: 1px solid var(--border);
}

header nav a {
  margin-right: 1rem;
}

.operator-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-direction: row;
  margin-left: auto;
}

.operator-badge span {
  color: var(--muted);
}

.operator-badge button {
  font-size: 0.85rem;
  padding: 0.3rem 0.6rem;
  background: transparent;
  color: inherit;
  border: 1px solid var(--border);
}

main {
  max-width: 48rem;
  margin: 2rem auto 0;
}

form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field label {
  font-weight: 600;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  padding: 0;
}

button:disabled {
  background: var(--border);
  color: var(--muted);
  cursor: not-allowed;
}

input,
select,
button {
  font-size: 1.25rem;
  padding: 0.6rem 0.75rem;
}

input[data-scan-input] {
  font-family: ui-monospace, monospace;
  letter-spacing: 0.03em;
}

button {
  cursor: pointer;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 0.25rem;
}

button:hover {
  background: #333;
}

.success {
  color: var(--success);
  font-weight: 600;
}

.error {
  color: var(--error);
  margin: 0;
}

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

.session-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--gap);
  padding-bottom: var(--gap);
  margin-bottom: var(--gap);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.session-banner form {
  gap: 0;
}

.session-banner button {
  font-size: 0.9rem;
  padding: 0.4rem 0.6rem;
  background: transparent;
  color: inherit;
  border: 1px solid var(--border);
}

.badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.1rem 0.5rem;
  border-radius: 1rem;
  background: var(--border);
  font-size: 0.85rem;
}

.tag {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
}

.tag-normal {
  background: var(--normal);
}

.tag-attention {
  background: var(--attention);
}

.tag-priority {
  background: var(--priority);
}

.button-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.tab {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  text-decoration: none;
  color: inherit;
  font-size: 0.9rem;
}

.tab-active {
  background: #1a1a1a;
  color: #fff;
  border-color: #1a1a1a;
}

/* Module-level navigation, as opposed to a filter strip within a screen.
   The rule below separates the two on Commission Reports, which stacks a
   date-range picker directly underneath. */
.module-tabs {
  padding-bottom: 0.9rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--border);
}

.field-row {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0.75rem 0;
}

.field-row label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.field-row input[type="date"] {
  font-size: 1rem;
  padding: 0.4rem 0.5rem;
}

.field-row button {
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--gap);
  display: block;
  overflow-x: auto;
}

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

td form {
  flex-direction: row;
  gap: 0.5rem;
}

td input[type="text"] {
  font-size: 1rem;
  padding: 0.3rem 0.5rem;
}

td button {
  font-size: 0.9rem;
  padding: 0.3rem 0.6rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
}

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

.stat-priority {
  border-color: var(--priority);
}

.stat-priority .stat-value {
  color: var(--priority);
}

.stat-attention {
  border-color: var(--attention);
}

.stat-attention .stat-value {
  color: var(--attention);
}

/* Kiosk screen — see kiosk.js. The same block styles the idle overlay and
   the standalone /home/ page; only .kiosk-overlay adds the covering layer. */
.kiosk-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  /* System colors, so the cover stays fully opaque in both light and dark
     (see color-scheme on :root). It has to hide the page underneath
     completely — a translucent wash would leave customer data legible on an
     unattended screen, which is half the point of the timeout. */
  background: Canvas;
  color: CanvasText;
}

/* Without this the display: flex above would beat the browser's rule for
   [hidden] and the overlay would never be hidden at all. */
.kiosk-overlay[hidden] {
  display: none;
}

.kiosk {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
  max-width: 26rem;
  margin: 0 auto;
  padding: 2rem var(--gap);
  text-align: center;
}

.kiosk-heading h2 {
  margin: 0 0 0.25rem;
}

.kiosk-heading p {
  margin: 0;
}

.kiosk-operator {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.kiosk-operator strong {
  font-size: 1.25rem;
}

.kiosk-actions {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  width: 100%;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* Deliberately oversized: these are hit with gloves on, at a glance, from
   standing height. */
.kiosk-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1.5rem 1rem;
  border-radius: 0.5rem;
  /* Matches the app's button language. The border does nothing in light mode
     but keeps these from sinking into the background in dark mode, where
     #1a1a1a is barely distinguishable from the page behind it. */
  border: 1px solid var(--border);
  background: #1a1a1a;
  color: #fff;
  font-size: 1.5rem;
  font-weight: 600;
  text-decoration: none;
}

.kiosk-action:hover {
  background: #333;
}

.kiosk-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.kiosk-link-form {
  gap: 0;
  width: auto;
}

/* Quiet on purpose. Resuming and switching operator are the exits from this
   screen, not the point of it. */
.kiosk-link,
.kiosk-link:hover {
  padding: 0.25rem;
  border: none;
  background: transparent;
  color: inherit;
  font-size: 1rem;
  text-decoration: underline;
}

/* The identify step. Sized like the kiosk screen it interrupts, so
   stepping from one to the other doesn't move everything on the terminal. */
.identify {
  width: 100%;
  max-width: 26rem;
  margin: 0 auto;
  padding: 2rem var(--gap);
}

.identify h2 {
  margin: 0 0 0.5rem;
}

/* States who the workstation currently belongs to. Deliberately quiet: it
   is information for the person walking up, not an offer to continue as
   them. */
.identify-previous {
  margin: 0 0 1rem;
}

/* The badge field is what the scanner is aimed at, so it gets the size. */
.identify input[name="badge"] {
  font-size: 1.25rem;
  padding: 0.75rem;
  letter-spacing: 0.05em;
}

@media print {
  header,
  .kiosk-overlay,
  .no-print {
    display: none !important;
  }

  body {
    padding: 0;
  }

  main {
    max-width: none;
    margin: 0;
  }
}
