main {
  max-width: 960px;
  margin: auto;
  padding: 16px;
}
[hidden] {
  display: none !important;
}
.device-grid {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(300px, 2fr);
  gap: 16px;
}
.device-grid .panel {
  margin: 0;
}
#pair {
  max-width: 410px;
  margin: 8vh auto;
}
#pair > button,
#save {
  background: #096963;
  color: white;
  margin-top: 10px;
}
#devices button {
  display: block;
  width: 100%;
  text-align: left;
  margin: 6px 0;
  overflow-wrap: anywhere;
}
#devices button[aria-pressed="true"] {
  background: #d6eeea;
  color: #14433d;
}
#devices small {
  display: block;
}
#new {
  margin-top: 16px;
}
#qr {
  display: block;
  margin: auto;
  max-width: 100%;
  height: auto;
}
.actions {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.actions a {
  color: #075f57;
  text-decoration: underline;
}
.actions.panel {
  margin-top: 16px;
}
.device-actions {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #c5d9d4;
}
#replace {
  color: #8a2c0a;
}
#disabled-note {
  margin: 16px 0 0;
  color: #8a2c0a;
}
#devices .device-off {
  color: #8a2c0a;
}
.confirm-mode {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
}
.confirm-mode h2 {
  margin: 0;
}
.confirm-mode .choice {
  align-items: flex-start;
  margin: 0;
  cursor: pointer;
}
.confirm-mode input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 3px 0 0;
}
.confirm-mode b,
.confirm-mode small {
  display: block;
}
.confirm-mode small {
  font-weight: 450;
  text-wrap: pretty;
}
/* app.css lays every label out as a grid, which would otherwise win over `hidden`. */
#table-field[hidden] {
  display: none;
}
#table-field small {
  font-weight: 450;
  text-wrap: pretty;
}
#group-field[hidden] {
  display: none;
}
/* The settings page: navigation on the left, the chosen group of settings beside it. */
main:has(.settings-layout) {
  max-width: 1180px;
}
.settings-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.settings-nav {
  position: sticky;
  top: 12px;
  display: grid;
  gap: 6px;
}
.settings-nav button,
.settings-nav a {
  display: block;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  color: #14433d;
  font: inherit;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
}
.settings-nav button:hover,
.settings-nav a:hover {
  background: #e4efed;
}
.settings-nav button[aria-pressed="true"] {
  background: #14433d;
  color: white;
}
/* Pages outside the settings follow the groups, a little apart. */
.settings-nav a:first-of-type {
  margin-top: 10px;
  padding-top: 16px;
  border-top: 1px solid #c5d9d4;
  border-radius: 0 0 10px 10px;
}
@media (max-width: 820px) {
  .settings-layout {
    grid-template-columns: 1fr;
  }
  .settings-nav {
    position: static;
    display: flex;
    flex-wrap: wrap;
  }
  .settings-nav a:first-of-type {
    margin-top: 0;
    padding-top: 10px;
    border-top: 0;
    border-radius: 10px;
  }
}
#table-detail {
  margin-bottom: 14px;
}
.settings-group {
  display: grid;
  gap: 16px;
}
.settings-group[hidden] {
  display: none;
}
/* Inside a group the gap spaces the panels; their own outer margins would double it. */
.settings-group > * {
  margin: 0;
}
/* The bulk form opens its own panel in the tables group, so it needs no divider above. */
.panel > .batch:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.tables-panel {
  display: grid;
  gap: 12px;
  margin: 0 0 16px;
}
.tables-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}
.tables-head h1,
#tables h2 {
  margin: 0;
}
.tables-head .choice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  cursor: pointer;
}
.tables-head .choice input {
  flex: none;
  width: 18px;
  height: 18px;
}
#tables {
  display: grid;
  gap: 14px;
}
#tables h2 {
  font-size: 15px;
  color: #315752;
}
.table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
  margin-top: 6px;
}
.table-tile {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  min-height: 84px;
  padding: 8px 6px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: #eef2f1;
  color: #2c3a37;
}
.table-tile strong {
  font-size: 22px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.table-tile span,
.table-tile small {
  font-size: 13px;
  font-weight: 600;
}
.table-tile[aria-pressed="true"] {
  border-color: #14433d;
}
/* What a table is doing. Text says it too; colour is only the quicker way to see it. */
.table-tile[data-state="pending"] {
  background: #ffe7c2;
  color: #6b3d00;
}
.table-tile[data-state="cooking"] {
  background: #d7e8ff;
  color: #123f7a;
}
.table-tile[data-state="ready"] {
  background: #cdefd6;
  color: #0f4d27;
}
.table-tile[data-state="seated"] {
  background: #e6defa;
  color: #3d2a78;
}
#table-detail {
  display: grid;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid #c5d9d4;
}
#table-detail[hidden] {
  display: none;
}
#table-detail ul {
  margin: 0;
  padding-left: 18px;
}
#table-clear {
  justify-self: start;
}
.batch {
  display: grid;
  gap: 10px;
  margin: 20px 0 12px;
  padding-top: 16px;
  border-top: 1px solid #c5d9d4;
}
.batch h2 {
  margin: 0;
}
#batch-preview {
  margin: 0;
  font-weight: 600;
  text-wrap: pretty;
}
.fee-panel {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
}
.fee-panel h2,
.fee-panel p {
  margin: 0;
}
.fee-row {
  display: flex;
  gap: 10px;
  align-items: end;
}
.fee-row label {
  flex: 1;
  max-width: 220px;
}
#fee-goods-now {
  font-weight: 600;
}
/* The table-code sheet exists only on paper. */
#sheet {
  display: none;
}
@media print {
  @page {
    margin: 10mm;
  }
  body > :not(#sheet) {
    display: none !important;
  }
  #sheet {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5mm;
  }
  #sheet figure {
    margin: 0;
    padding: 5mm 4mm;
    border: 0.3mm dashed #999;
    text-align: center;
    break-inside: avoid;
  }
  #sheet img {
    display: block;
    width: 100%;
    height: auto;
  }
  #sheet figcaption {
    font-size: 20pt;
    font-weight: 700;
  }
  #sheet small {
    display: block;
    font-size: 9pt;
  }
}
.panel select {
  font: inherit;
  padding: 10px;
  max-width: 100%;
}
#status {
  min-height: 1.3em;
  color: #315752;
}
#publication {
  border-top: 1px solid #c5d9d4;
  margin-top: 18px;
}
#publication p {
  text-align: center;
}
@media (max-width: 650px) {
  .device-grid {
    grid-template-columns: 1fr;
  }
}

.settings-logo {
  width: clamp(100px, 15vw, 152px);
  height: auto;
}
body.device-activation {
  min-height: 100dvh;
  background:
    radial-gradient(ellipse at 97% 2%, #d7f2f8 0, transparent 24%),
    radial-gradient(ellipse at 0% 100%, #e0f4f8 0, transparent 34%), #f8fafa;
}
.device-activation header {
  background: transparent;
  border: 0;
  padding: clamp(16px, 4vw, 48px);
}
.device-activation #pair {
  width: min(92%, 720px);
  max-width: none;
  margin: clamp(50px, 13vh, 185px) auto 45px;
}
.device-activation #pair h1 {
  margin: 0 0 clamp(22px, 4vw, 40px);
  text-align: center;
  color: #191c1d;
  font-size: clamp(32px, 6vw, 60px);
}
.activation-help {
  margin: 0 0 clamp(27px, 6vw, 55px);
  padding: clamp(12px, 2vw, 22px);
  text-align: center;
  border: 1px solid #9dd5de;
  border-radius: 7px;
  background: #e0f4f8;
  color: #006576;
  font-weight: 600;
}
.device-activation #pair label {
  color: #5d6b7a;
}
.device-activation #pair input {
  border: 1px solid #b2bbce;
  background: white;
  border-radius: 7px;
  min-height: 46px;
}
.device-activation #pair > button {
  width: 100%;
  margin-top: clamp(18px, 4vw, 48px);
  background: #008ba1;
  border: 0;
  border-radius: 8px;
  min-height: 48px;
  font-size: 18px;
  font-weight: 650;
}
.device-activation #pair .human-check {
  margin-top: clamp(14px, 3vw, 28px);
}

/* ---- A calmer settings page: titles with their actions beside them, short hints ---- */
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}
.panel-head h1,
.panel-head h2,
.panel-head .actions {
  margin: 0;
}
.panel h1 {
  font-size: 22px;
}
.panel h2 {
  font-size: 17px;
}
/* One line that explains, never a paragraph. */
.hint {
  margin: 0;
  color: #5b6f6a;
  font-size: 13px;
  font-weight: 450;
  text-wrap: pretty;
}
.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px 14px;
}
.clock-form {
  display: grid;
  gap: 10px;
}
.clock-form > button {
  justify-self: start;
}
.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
}
.quiet-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 0;
  font-weight: 500;
  cursor: pointer;
}
.quiet-choice input {
  flex: none;
  width: 18px;
  height: 18px;
}
.tables-panel .batch {
  margin: 0;
  padding: 12px;
  border: 1px solid #c5d9d4;
  border-radius: 10px;
}
#table-detail ul:empty {
  display: none;
}
/* Touch screens: controls a finger can hit, and no zoom on focusing a field. */
@media (pointer: coarse) {
  .panel button,
  .panel a,
  .panel select,
  .panel input:not([type="checkbox"]):not([type="radio"]) {
    min-height: 46px;
    font-size: 16px;
  }
  .table-tile {
    min-height: 96px;
  }
}

/* ---- Pairing codes ---- */
.code-form {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #c5d9d4;
  border-radius: 10px;
}
.code-issued {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid #9dd5de;
  border-radius: 10px;
  background: #e0f4f8;
}
.code-issued p {
  margin: 0;
  text-wrap: pretty;
}
.code-plain {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.code-plain code {
  font:
    600 clamp(19px, 5.6vw, 24px) / 1.3 ui-monospace,
    Consolas,
    monospace;
  letter-spacing: 0.06em;
  user-select: all;
}
.code-list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}
.code-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 10px 0;
  border-top: 1px solid #dbe7e4;
}
.code-list li:first-child {
  border-top: 0;
}
.code-list li > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.code-list strong {
  overflow-wrap: anywhere;
}
.code-list small {
  color: #5b6f6a;
  font-size: 13px;
}
.code-list button.danger {
  border-color: #a3311f;
  color: #a3311f;
}

/* ---- A short header on every back-office page ---- */
body > header {
  min-height: 52px;
  padding-block: 6px;
  gap: 12px;
}
.settings-logo {
  width: clamp(76px, 9vw, 104px);
}
.settings-tools {
  flex: 1 1 auto;
  min-width: 0;
}
#shop {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.panel h1 {
  font-size: 20px;
}
/* A form reads better at the width of what is typed into it. */
.clock-form,
.code-form {
  max-width: 620px;
}
@media (max-width: 820px) {
  /* The groups in one row that scrolls sideways, instead of three wrapped rows. */
  .settings-nav {
    flex-wrap: nowrap;
    gap: 4px;
    margin-inline: -4px;
    padding: 2px 4px 6px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .settings-nav::-webkit-scrollbar {
    display: none;
  }
  .settings-nav button,
  .settings-nav a {
    flex: none;
    white-space: nowrap;
  }
}
@media (max-width: 520px) {
  #shop {
    display: none;
  }
}

.money-sample {
  color: #14433d;
  font-size: 17px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.fee-goods {
  display: grid;
  gap: 8px;
}
#fee-goods-search {
  flex: 1 1 200px;
  max-width: 320px;
}
.fee-goods-list {
  max-height: 340px;
  overflow-y: auto;
}
.fee-goods-list li[data-current="true"] {
  background: #e4f1ee;
}
.fee-goods-list li {
  padding-inline: 10px;
  border-radius: 8px;
}

/* ---- The tables on the left, the chosen table and its orders on the right ---- */
@media (min-width: 1000px) {
  .tables-group:has(#table-card:not([hidden])) {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
    align-items: start;
  }
  .tables-group #table-card {
    position: sticky;
    top: 12px;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
  }
}
.table-orders {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.table-order {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid #d5e3e0;
  border-radius: 10px;
  background: white;
}
.table-order-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.table-order-head > strong:last-child {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.table-order-state {
  padding: 1px 8px;
  border-radius: 999px;
  background: #e4f1ee;
  color: #14433d;
  font-size: 12px;
  font-weight: 650;
}
.table-order[data-state="pending"] .table-order-state {
  background: #fdf0d2;
  color: #7a4d00;
}
.table-order[data-state="ready"] .table-order-state {
  background: #e3f5e1;
  color: #146c1f;
}
.table-order > small {
  color: #5b6f6a;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.table-order-lines {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 6px 0 0;
  border-top: 1px dashed #d5e3e0;
  list-style: none;
}
.table-order-lines li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
}
.table-order-lines span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.table-order-lines b {
  flex: none;
  color: #5b6f6a;
  font-variant-numeric: tabular-nums;
}
.table-order-cancel {
  justify-self: end;
  min-height: 38px;
  padding: 4px 14px;
  color: #a3311f;
}
.table-order-cancel.danger {
  border-color: #a3311f;
  background: #a3311f;
  color: white;
}
.table-detail-total {
  margin: 0;
  font-weight: 650;
  text-align: right;
}
#table-detail-empty {
  margin: 0;
}
