/* LuLuDIY base styles. The palette and type come from the stakeholder demo (demo/public/index.html), which takes them
   from the logo: its blues and its stitched, dashed border. */
:root {
  --bg: #edf5fd;
  --paper: #ffffff;
  --ink: #0b2a55;
  --ink-2: #48627f;
  --line: #cde1f5;
  --blue: #0a6fcc;
  --navy: #0a4da3;
  --sky: #7ccbff;
  --on-accent: #ffffff;
  --shadow: 0 10px 30px rgba(10, 77, 163, 0.13);
  --radius: 18px;
  --font-display: "Fredoka", "Mitr", "PingFang SC", "Noto Sans SC", ui-rounded, system-ui, sans-serif;
  --font-body: "Nunito", "Mitr", "PingFang SC", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1b33;
    --paper: #102847;
    --ink: #e6f1ff;
    --ink-2: #a3bbd9;
    --line: #28496f;
    --blue: #5fb0f7;
    --navy: #9ccbff;
    --sky: #4f9ad6;
    --on-accent: #06203f;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
}

/* Thai sits taller than Latin text and needs a little more line height to stay readable. */
:lang(th) body,
body:lang(th) {
  line-height: 1.7;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(1.6rem, 1.2rem + 2vw, 2.2rem);
  color: var(--navy);
}

p {
  margin: 0 0 1em;
}

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

:focus-visible {
  outline: 3px solid var(--sky);
  outline-offset: 2px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}

.brand img {
  display: block;
  width: 150px;
  height: auto;
  border-radius: 12px;
}

.lang {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
}

.lang a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 9px;
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--ink-2);
  text-decoration: none;
}

.lang a[aria-current="true"] {
  background: var(--blue);
  color: var(--on-accent);
}

.page {
  flex: 1;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 8px max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left));
}

.card {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 36px);
  /* The logo's stitched border. */
  outline: 2px dashed var(--line);
  outline-offset: -10px;
}

.hero {
  max-width: 640px;
}

.eyebrow {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 0.4em;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: 12px;
  background: var(--blue);
  color: var(--on-accent);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 16px;
  text-decoration: none;
  cursor: pointer;
}

.foot {
  text-align: center;
  color: var(--ink-2);
  font-size: 14px;
  padding: 16px 16px max(16px, env(safe-area-inset-bottom));
}

/* --- Shared pieces for the table page and the staff tablet --------------------------------------------------------- */

.btn.ghost {
  background: transparent;
  color: var(--blue);
  box-shadow: inset 0 0 0 2px var(--line);
}
.btn.small {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 14px;
}
.btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.big-btn {
  width: 100%;
  min-height: 56px;
  font-size: 20px;
  margin: 8px 0 12px;
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.stack {
  display: grid;
  gap: 12px;
}
.muted {
  color: var(--ink-2);
}
.small {
  font-size: 14px;
}
.lead {
  font-size: 1.15rem;
}
.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--navy);
  color: var(--on-accent);
  font-size: 12px;
  font-weight: 700;
  vertical-align: middle;
}
.price .was {
  color: var(--ink-2);
  margin-right: 4px;
}
.msg {
  padding: 10px 14px;
  border-radius: 12px;
  background: #fde8e8;
  color: #8a1c1c;
}
.offline,
.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-weight: 700;
}
.offline {
  top: max(12px, env(safe-area-inset-top));
  background: #fff4d6;
  color: #6b4b00;
}
.toast {
  bottom: max(16px, env(safe-area-inset-bottom));
  background: var(--ink);
  color: var(--bg);
}
[hidden] {
  display: none !important;
}
.input {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}
.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}
dialog.sheet {
  width: min(560px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  border: 0;
  border-radius: var(--radius);
  padding: 20px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
}
dialog.sheet::backdrop {
  background: rgba(6, 20, 40, 0.45);
}
.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

/* --- The customer table page ---------------------------------------------------------------------------------------- */

.table-card {
  max-width: 560px;
  margin: 0 auto 16px;
}
.rates {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  font-size: 1.3rem;
}
.meter {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 8px 0 12px;
}
.meter .label {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
}
.meter .big {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 1.4rem + 3vw, 2.6rem);
  font-variant-numeric: tabular-nums;
  color: var(--navy);
}
.breakdown,
.product-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}
.breakdown li,
.product-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}
.products {
  max-width: 560px;
  margin: 0 auto;
}
/* A product's photo, when it has one, beside its name at a fixed size (plan task 4.7). */
.product-list li {
  align-items: center;
}
.product-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.product-thumb {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--line);
}
.product-list .price {
  flex: none;
  white-space: nowrap;
}
.call {
  margin-top: 8px;
}
.calling {
  font-weight: 700;
  color: var(--navy);
}

/* --- The staff tablet ----------------------------------------------------------------------------------------------- */

.staff-page .page {
  max-width: 1280px;
}
.staff-page .top {
  max-width: 1280px;
}
.staff-page .brand img {
  width: 96px;
}
.staff-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}
.staff-bar p {
  margin: 0;
}
[data-sound].on {
  box-shadow: inset 0 0 0 2px var(--blue);
}
.alerts {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.alert {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 6px;
  border-radius: 14px;
  background: #ffe9c7;
}
.alert.vip_call {
  background: #ffd6e7;
}
.alert-btn {
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 700;
  color: #5a2a00;
  padding: 6px 8px;
  cursor: pointer;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.tile {
  position: relative;
  display: grid;
  gap: 2px;
  align-content: start;
  text-align: left;
  min-height: 120px;
  padding: 14px;
  border: 0;
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  font: inherit;
  cursor: pointer;
}
.tile-name {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
}
.tile-state {
  color: var(--ink-2);
  font-size: 14px;
}
.tile-time,
.tile-price {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.tile.in_use {
  box-shadow: inset 0 0 0 3px var(--blue), var(--shadow);
}
.tile.end_requested,
.tile.calling {
  box-shadow: inset 0 0 0 3px #e08a00, var(--shadow);
}
/* An ended table's bill is waiting at the counter: the tile is filled, so it stands out from the running ones. */
.tile.ended {
  background: var(--navy);
  color: var(--on-accent);
}
.tile.ended .tile-state {
  color: inherit;
  font-weight: 800;
}
.tile.ended .badge,
.tile.ended .flag {
  background: var(--on-accent);
  color: var(--navy);
}
.tile.out_of_service {
  opacity: 0.55;
}
.flag {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #e08a00;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
}
.meter-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
}
.actions {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.actions .btn {
  min-height: 52px;
}
.pick-list {
  list-style: none;
  padding: 0;
  margin: 12px 0;
  display: grid;
  gap: 8px;
  max-height: 50dvh;
  overflow: auto;
}
.pick {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.pick[aria-pressed="true"] {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue);
}
.pick-row {
  display: flex;
  gap: 8px;
}
.pick-row .pick {
  flex: 1;
  min-width: 0;
}
.pick .count {
  display: inline-block;
  margin-left: 10px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--blue);
  color: var(--on-accent);
  font-weight: 800;
}
.key.less:disabled {
  visibility: hidden;
}
.cart {
  margin: 0 0 4px;
  font-weight: 700;
}
.cart.muted {
  font-weight: 400;
}
.qty-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}
.qty-row output {
  min-width: 2ch;
  text-align: center;
  font-size: 1.3rem;
}
.pin-sheet {
  width: min(360px, calc(100% - 24px));
}
.pin-dots {
  font-size: 28px;
  letter-spacing: 8px;
  text-align: center;
}
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.key {
  min-height: 60px;
  border: 0;
  border-radius: 14px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 24px;
  cursor: pointer;
}
.key.ghost {
  font-size: 15px;
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--line);
}
.key.small {
  min-height: 44px;
  min-width: 44px;
  font-size: 20px;
}
.pin-sheet.busy .keypad {
  opacity: 0.5;
  pointer-events: none;
}
.pin-what {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--navy);
  margin-bottom: 0.25em;
}
.breakdown li.total {
  border-bottom: 0;
  font-size: 1.15rem;
}
dialog.sheet.wide {
  width: min(720px, calc(100% - 24px));
}
.bill-lines {
  list-style: none;
  padding: 0;
  margin: 12px 0;
}
.bill-lines li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.bill-lines .amount {
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.bill-lines .note {
  grid-column: 1 / -1;
  color: var(--ink-2);
  font-size: 14px;
}
.bill-lines .removed .name {
  text-decoration: line-through;
  color: var(--ink-2);
}
.bill-lines .changed .amount strong {
  color: var(--navy);
}
.bill-total {
  display: flex;
  justify-content: space-between;
  font-size: 1.3rem;
  margin: 8px 0 12px;
}
.pay {
  margin-bottom: 8px;
}
.pay .pick {
  flex: 1;
  justify-content: center;
}
.row.end {
  justify-content: flex-end;
  margin-top: 12px;
}
.grow {
  flex: 1;
  min-width: 0;
  width: auto;
}
.bill-view {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 2px dashed var(--line);
}
.bill-view h3 {
  margin-bottom: 0.2em;
}
.amendment {
  margin: 8px 0 0 12px;
  padding-left: 12px;
  border-left: 3px solid var(--line);
}
.stepper {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.refund-form {
  margin: 8px 0;
  padding: 12px;
  border-radius: 12px;
  background: var(--bg);
}

/* --- The tablet's pairing page (src/views/pair.tsx) ------------------------------------------------------------------ */

.pair {
  max-width: 560px;
}
.pair h1 {
  margin-top: 0;
}
/* The shop's and the tablet's names, which the admin typed, wrap rather than widen the page. */
.pair-question {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.pair [data-pair-current] {
  margin: 0;
  overflow-wrap: anywhere;
}
