/* Herman – café style */
:root {
  --bg: #f6f0e8;
  --bg-2: #efe5d8;
  --card: #fffaf4;
  --ink: #2b1d14;
  --ink-soft: #6b5545;
  --line: #e2d3c1;
  --coffee: #6f4426;
  --coffee-dark: #4a2c18;
  --crema: #c8915b;
  --crema-soft: #f3dfc6;
  --ok: #2f7a4b;
  --ok-soft: #dcefe2;
  --danger: #a8322b;
  --danger-soft: #f7dedb;
  --shadow: 0 1px 2px rgba(60, 35, 15, 0.06), 0 8px 24px rgba(60, 35, 15, 0.08);
  --radius: 22px;
  --focus: 0 0 0 4px rgba(200, 145, 91, 0.45);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 600px at 100% -10%, var(--crema-soft), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, var(--bg-2), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 18px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input { font: inherit; color: inherit; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 40px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
  color: var(--coffee-dark);
  text-decoration: none;
}
.brand-mark {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: var(--coffee);
  color: #fff;
  box-shadow: var(--shadow);
}
.brand-mark svg { width: 26px; height: 26px; }
.brand small { display: block; font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); letter-spacing: 0; }

.wrap {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 8px clamp(16px, 4vw, 40px) 48px;
}

/* ---------- Customer page ---------- */

.order-form { display: grid; gap: 28px; }

.field-label {
  display: block;
  font-weight: 800;
  font-size: 1.35rem;
  margin: 0 0 10px;
  color: var(--coffee-dark);
}
.step {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; margin-right: 10px;
  border-radius: 50%;
  background: var(--coffee); color: #fff;
  font-size: 1rem; vertical-align: 2px;
}

.name-input {
  width: 100%;
  min-height: 72px;
  padding: 16px 22px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 1.6rem;
  font-weight: 700;
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.name-input::placeholder { color: #b9a592; font-weight: 600; }
.name-input:focus { outline: none; border-color: var(--crema); box-shadow: var(--focus); }
.name-input[aria-invalid="true"] { border-color: var(--danger); }

.field-error { min-height: 1.4em; margin: 8px 4px 0; color: var(--danger); font-weight: 700; font-size: 1rem; }

.products {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(12px, 2vw, 20px);
  border: 0; padding: 0; margin: 0;
}
@media (max-width: 640px) {
  .products { grid-template-columns: 1fr; }
}

.product {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 200px;
  padding: 24px 16px;
  border: 3px solid transparent;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: center;
  transition: transform .12s ease, border-color .15s, background .15s, box-shadow .15s;
  touch-action: manipulation;
}
@media (max-width: 640px) {
  .product { flex-direction: row; justify-content: flex-start; min-height: 96px; padding: 16px 20px; text-align: left; }
  .product .product-icon { width: 60px; height: 60px; }
}
.product:hover { transform: translateY(-2px); }
.product:active { transform: scale(0.98); }
.product:focus-visible { outline: none; box-shadow: var(--focus), var(--shadow); }
.product[aria-checked="true"] {
  border-color: var(--coffee);
  background: var(--crema-soft);
}
.product-icon {
  width: 84px; height: 84px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--coffee);
  flex: none;
  transition: background .15s, color .15s;
}
.product-icon svg { width: 60%; height: 60%; }
.product[aria-checked="true"] .product-icon { background: var(--coffee); color: #fff; }
.product-name { font-size: 1.5rem; font-weight: 800; line-height: 1.15; }
.product-desc { display: block; font-size: 0.95rem; color: var(--ink-soft); }
.product-check {
  position: absolute; top: 12px; right: 12px;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--coffee); color: #fff;
  opacity: 0; transform: scale(.5);
  transition: opacity .15s, transform .2s cubic-bezier(.3,1.6,.5,1);
}
.product-check svg { width: 20px; height: 20px; }
.product[aria-checked="true"] .product-check { opacity: 1; transform: scale(1); }
@media (max-width: 640px) { .product-check { top: 50%; margin-top: -17px; right: 16px; } }

.submit {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%;
  min-height: 84px;
  border: 0;
  border-radius: var(--radius);
  background: var(--coffee);
  color: #fff;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  box-shadow: 0 10px 24px rgba(111, 68, 38, 0.3);
  cursor: pointer;
  transition: background .15s, transform .1s, opacity .15s;
  touch-action: manipulation;
}
.submit:hover { background: var(--coffee-dark); }
.submit:active { transform: scale(0.99); }
.submit:focus-visible { outline: none; box-shadow: var(--focus); }
.submit:disabled { opacity: .55; cursor: not-allowed; }
.submit .spinner { display: none; }
.submit[aria-busy="true"] .spinner { display: inline-block; }

.spinner {
  width: 26px; height: 26px;
  border: 3px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.form-error {
  margin: 0;
  padding: 14px 18px;
  border-radius: 16px;
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 700;
}
.form-error:empty { display: none; }

/* Confirmation overlay */
.confirm-overlay {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  padding: 24px;
  background: rgba(43, 29, 20, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 10;
  animation: fade-in .2s ease;
}
.confirm-overlay[hidden] { display: none; }
.confirm-card {
  width: min(520px, 100%);
  padding: 40px 32px 32px;
  border-radius: 28px;
  background: var(--card);
  text-align: center;
  box-shadow: 0 30px 80px rgba(43, 29, 20, 0.35);
  animation: pop-in .35s cubic-bezier(.2,1.4,.4,1);
}
.confirm-badge {
  width: 96px; height: 96px; margin: 0 auto 18px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--ok); color: #fff;
}
.confirm-badge svg { width: 54px; height: 54px; }
.confirm-badge path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .45s .15s ease forwards; }
.confirm-title { margin: 0 0 6px; font-size: 2rem; font-weight: 800; color: var(--coffee-dark); }
.confirm-text { margin: 0 0 24px; font-size: 1.25rem; color: var(--ink-soft); }
.confirm-text strong { color: var(--ink); }
.confirm-next {
  width: 100%; min-height: 64px;
  border: 2px solid var(--line); border-radius: 18px;
  background: var(--bg); font-size: 1.2rem; font-weight: 800; cursor: pointer;
  position: relative; overflow: hidden;
}
.confirm-next:focus-visible { outline: none; box-shadow: var(--focus); }
.confirm-next .bar {
  position: absolute; left: 0; bottom: 0; height: 4px; width: 100%;
  background: var(--crema); transform-origin: left;
}

@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.85) translateY(10px); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes shrink { from { transform: scaleX(1); } to { transform: scaleX(0); } }

.footer-link {
  margin-top: 32px; text-align: center; font-size: .9rem;
}
.footer-link a { color: var(--ink-soft); }

/* ---------- Barista page ---------- */

.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow);
  font-weight: 700; font-size: .95rem;
}
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #b9a592; }
.status-pill[data-state="live"] .status-dot { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.status-pill[data-state="offline"] { color: var(--danger); }
.status-pill[data-state="offline"] .status-dot { background: var(--danger); }

.barista-wrap { max-width: 1400px; }

.queue-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin: 4px 0 18px;
}
.queue-head h1 { margin: 0; font-size: 1.9rem; letter-spacing: -0.02em; color: var(--coffee-dark); }
.queue-count { font-weight: 800; color: var(--ink-soft); font-size: 1.15rem; }

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

.order {
  position: relative;
  display: flex; flex-direction: column; gap: 14px;
  padding: 22px;
  border: 3px solid transparent;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: order-in .45s cubic-bezier(.2,1.2,.4,1);
  transition: background .25s, border-color .25s, opacity .35s, transform .35s;
}
.order.is-new { border-color: var(--crema); }
.order-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.order-num {
  font-weight: 800; font-size: .95rem; color: var(--ink-soft);
}
.order-time { white-space: nowrap; font-weight: 700; color: var(--ink-soft); font-variant-numeric: tabular-nums; font-size: 1rem; }
.order-name {
  margin: 0;
  font-size: clamp(1.9rem, 3.2vw, 2.4rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  word-break: break-word;
}
.order-product {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--crema-soft);
  color: var(--coffee-dark);
  font-size: 1.45rem; font-weight: 800;
}
.order-product .product-icon { width: 48px; height: 48px; background: var(--coffee); color: #fff; }
.order-status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px;
  font-size: .9rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  background: var(--bg-2); color: var(--coffee);
}
.order-confirm {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 72px;
  border: 0; border-radius: 18px;
  background: var(--coffee); color: #fff;
  font-size: 1.5rem; font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
  transition: background .15s, transform .1s;
}
.order-confirm svg { width: 28px; height: 28px; }
.order-confirm:hover { background: var(--coffee-dark); }
.order-confirm:active { transform: scale(.98); }
.order-confirm:focus-visible { outline: none; box-shadow: var(--focus); }
.order-confirm:disabled { opacity: .6; cursor: default; }

/* confirmed state */
.order.is-confirmed { background: var(--ok-soft); border-color: var(--ok); }
.order.is-confirmed .order-status { background: var(--ok); color: #fff; }
.order.is-confirmed .order-product { background: rgba(255,255,255,.6); }
.order.is-confirmed .order-product .product-icon { background: var(--ok); }
.order.is-confirmed .order-confirm { background: var(--ok); opacity: 1; }
.order-timer {
  position: absolute; left: 0; bottom: 0; height: 6px; width: 100%;
  background: var(--ok); transform-origin: left;
}
.order.is-leaving { opacity: 0; transform: scale(.92); }

@keyframes order-in {
  from { opacity: 0; transform: translateY(-16px) scale(.96); }
}

.empty {
  display: grid; place-items: center; gap: 10px;
  padding: 80px 20px;
  border: 3px dashed var(--line);
  border-radius: var(--radius);
  text-align: center; color: var(--ink-soft);
}
.empty svg { width: 64px; height: 64px; color: var(--crema); }
.empty p { margin: 0; font-size: 1.3rem; font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
