/* Ponovia. The same colours and system fonts as the RSO app, so staff and agents
   are looking at one product. The code is the one loud thing here; everything
   else is plain iOS grouped lists. */

:root {
  color-scheme: light dark;
  --tint: #0a66ff;
  --hero: linear-gradient(135deg, #0b3fd1 0%, #0a66ff 38%, #16a3f5 72%, #19c3b7 100%);
  --hero-done: linear-gradient(135deg, #0a7a4b 0%, #18a558 55%, #34c759 100%);
  --hero-over: linear-gradient(135deg, #3a4257 0%, #5a6478 100%);
  --bg: #f2f2f7;
  --card: #ffffff;
  --text: #1c1c1e;
  --muted: #6e6e73;
  --line: rgba(60, 60, 67, 0.18);
  --fill: rgba(118, 118, 128, 0.12);
  --red: #d70015;
  --green: #1b8a3e;
  --column: 760px;
  --sans: -apple-system, 'SF Pro Text', system-ui, 'Helvetica Neue', Arial, sans-serif;
  --rounded: ui-rounded, 'SF Pro Rounded', -apple-system, system-ui, 'Helvetica Neue', Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --text: #f5f5f7;
    --muted: #98989f;
    --line: rgba(84, 84, 88, 0.6);
    --fill: rgba(118, 118, 128, 0.24);
    --tint: #4a90ff;
    --red: #ff6961;
    --green: #30d158;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--tint); }

:focus-visible { outline: 3px solid var(--tint); outline-offset: 2px; }
.band :focus-visible { outline-color: #fff; }

/* The band: the app's Pacific gradient, full width. */

.band {
  background: var(--hero);
  color: #fff;
  padding: 0 16px 40px;
}

.top, .hero-text, .issue, .issued, .batch, main {
  max-width: var(--column);
  margin-inline: auto;
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  padding: 16px 0 28px;
}

.brand {
  color: inherit;
  font: 700 21px/1 var(--rounded);
  letter-spacing: -0.01em;
  text-decoration: none;
}

nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }

nav form { margin: 0; }

nav a, nav button {
  border: 0;
  border-radius: 999px;
  background: none;
  color: #fff;
  cursor: pointer;
  font: 500 15px/1 var(--sans);
  padding: 8px 12px;
  text-decoration: none;
}

nav a:hover, nav button:hover { background: rgba(255, 255, 255, 0.16); }
nav a[aria-current='page'] { background: rgba(255, 255, 255, 0.24); }

h1 {
  font: 800 34px/1.12 var(--sans);
  letter-spacing: -0.025em;
  margin: 0 0 8px;
}

.hero-text p { margin: 0 0 16px; max-width: 52ch; opacity: 0.92; }

/* Where you are in the setup wizard. */

.steps {
  counter-reset: step;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
}

.steps li {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  counter-increment: step;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 14px;
}

.steps li::before { content: counter(step) ". "; }
.steps li[aria-current='step'] { background: #fff; color: #0b3fd1; }

/* Creating a code, on the band. */

.issue h1 { margin-bottom: 18px; }

.servers {
  border: 0;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  margin: 0 0 14px;
  padding: 0;
}

.servers legend, .on-band-field span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  opacity: 0.92;
  padding: 0;
}

.server-choice input { position: absolute; opacity: 0; }

.server-choice span {
  background: rgba(255, 255, 255, 0.14);
  border: 2px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  display: block;
  padding: 10px 14px;
}

.server-choice b { display: block; font-size: 17px; }
.server-choice small { display: block; font-size: 13px; opacity: 0.85; overflow-wrap: anywhere; }

.server-choice input:checked + span { background: #fff; color: #0b3fd1; }
.server-choice input:focus-visible + span { outline: 3px solid #fff; outline-offset: 2px; }

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

.on-band-field { display: block; }
.on-band-field.grow { flex: 1 1 240px; }

.on-band-field input, .on-band-field select {
  appearance: none;
  background: rgba(255, 255, 255, 0.95);
  border: 0;
  border-radius: 12px;
  color: #1c1c1e;
  font: 17px/1.2 var(--sans);
  height: 46px;
  padding: 0 14px;
  width: 100%;
}

.on-band-field select { min-width: 150px; }
.on-band-field.quantity { flex: 0 0 110px; }

.on-band {
  background: rgba(255, 255, 255, 0.2);
  border: 0;
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  display: inline-block;
  font: 600 17px/1 var(--sans);
  padding: 15px 22px;
  text-decoration: none;
}

.on-band:hover { background: rgba(255, 255, 255, 0.3); }
.on-band.strong { background: #fff; color: #0b3fd1; }
.on-band.strong:hover { background: #e8f0ff; }
.on-band.quiet { background: none; }

/* The code. Read aloud over the phone, so it has to work from across a desk. */

.issued-for { font-size: 17px; margin: 0 0 4px; opacity: 0.95; }

.digits {
  display: flex;
  flex-wrap: wrap;
  font: 700 clamp(72px, 19vw, 148px)/1.05 var(--rounded);
  font-variant-numeric: tabular-nums;
  gap: 0 0.28em;
  letter-spacing: 0.015em;
  margin: 0 0 14px -0.03em;
}

.life {
  background: rgba(255, 255, 255, 0.24);
  border-radius: 3px;
  height: 6px;
  overflow: hidden;
}

.life-left {
  background: #fff;
  border-radius: 3px;
  height: 100%;
  transition: width 1s linear;
  width: 100%;
}

.issued-state {
  font-size: 19px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  margin: 12px 0 18px;
  min-height: 1.45em;
}

.issued-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.issued-note { font-size: 14px; margin: 14px 0 0; opacity: 0.88; }

/* A batch: read from a sheet or a screen, so smaller than a single code. */

.batch-codes {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
}

.batch-codes li {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  min-width: 0;
  padding: 8px 12px;
}

.batch-codes small { display: block; font-size: 13px; opacity: 0.9; overflow-wrap: anywhere; }
.batch-codes b { display: block; font: 700 26px/1.2 var(--rounded); font-variant-numeric: tabular-nums; }

/* The band changes colour behind the code, so staff can see from across the room. */

.band:has(.is-connected) { background: var(--hero-done); }
.band:has(.is-over) { background: var(--hero-over); }
.is-connected .digits, .is-over .digits { opacity: 0.45; text-decoration: line-through; text-decoration-thickness: 0.05em; }
.is-connected .life, .is-over .life { visibility: hidden; }

/* Lists and forms. */

main { max-width: calc(var(--column) + 32px); padding: 28px 16px 64px; }

section + section { margin-top: 32px; }

h2 {
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 8px 16px;
}

.group {
  background: var(--card);
  border-radius: 14px;
  list-style: none;
  margin: 0;
  overflow: hidden;
  padding: 0;
}

.row {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  min-height: 60px;
  padding: 10px 16px;
}

.row + .row { border-top: 0.5px solid var(--line); }
.row > div:first-child { min-width: 0; }
.row b { display: block; font-weight: 600; }
.row small { color: var(--muted); display: block; font-size: 14px; overflow-wrap: anywhere; }
.row time { color: var(--muted); flex: none; font-size: 14px; font-variant-numeric: tabular-nums; }
.row form { margin: 0; }

.row-actions { align-items: center; display: flex; flex: none; gap: 14px; }
.row-actions a { text-decoration: none; }

.danger-text {
  background: none;
  border: 0;
  color: var(--red);
  cursor: pointer;
  font: inherit;
  padding: 4px 0;
  white-space: nowrap;
}

.empty, .note {
  color: var(--muted);
  font-size: 14px;
  margin: 8px 16px 0;
}

.field {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 150px 1fr;
  min-height: 48px;
  padding: 2px 16px;
}

.field + .field { border-top: 0.5px solid var(--line); }

.field input, .field select {
  appearance: none;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  height: 44px;
  min-width: 0;
  width: 100%;
}

.field input:focus, .field select:focus { outline: none; }
.field:focus-within { box-shadow: inset 3px 0 0 var(--tint); }

.actions {
  align-items: center;
  border-top: 0.5px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 12px 16px;
}

.primary {
  background: var(--tint);
  border: 0;
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  font: 600 17px/1 var(--sans);
  padding: 14px 22px;
}

.primary:hover { filter: brightness(1.08); }
.primary.finish { display: inline-block; text-decoration: none; }
.plain-note { margin: 0; padding: 14px 16px; }
.plain { text-decoration: none; }

.problem, .saved {
  font-size: 15px;
  font-weight: 500;
  margin: 0;
  padding: 12px 16px;
}

.problem { border-bottom: 0.5px solid var(--line); color: var(--red); }
.saved { border-bottom: 0.5px solid var(--line); color: var(--green); }
.on-band-problem { background: #fff; border: 0; border-radius: 12px; color: #c00014; margin-bottom: 14px; }

@media (max-width: 560px) {
  h1 { font-size: 30px; }
  nav { margin-left: -12px; }
  .field { gap: 0; grid-template-columns: 1fr; padding-block: 8px 2px; }
  .field span { color: var(--muted); font-size: 13px; }
  .field input, .field select { height: 36px; }
  .row { align-items: flex-start; }
  .row time { max-width: 88px; text-align: right; }
}

@media print {
  body { background: #fff; color: #000; }
  .top, main, .issued-actions, .issued-note { display: none; }
  .band { background: none; color: #000; padding: 0; }
  .batch-codes li { background: none; border: 1px solid #999; break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) {
  .life-left { transition: none; }
}
