:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: #253127;
  background: #f6f3ea;
  font-synthesis: none;
  --paper: #fffdf7;
  --ink: #253127;
  --muted: #5c6357;
  --line: #dedbcf;
  --green: #254634;
  --green-dark: #193527;
  --corn: #f1cf75;
  --danger: #942e29;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #92681f;
  outline-offset: 3px;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 3.15rem); letter-spacing: -.075em; line-height: 1; }
h2 { font-size: 1.25rem; letter-spacing: -.035em; line-height: 1.2; }
h3 { font-size: 1rem; line-height: 1.25; }
a { color: inherit; }
.app-header { background: var(--paper); border-bottom: 1px solid var(--line); }
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  max-width: 1220px;
  min-height: 72px;
  margin: auto;
  padding: .7rem clamp(1rem, 3vw, 2.25rem);
}
.identity, .header-actions { display: flex; align-items: center; gap: .7rem; }
.brand-mark {
  position: relative;
  display: block;
  flex: 0 0 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--green);
}
.brand-mark::before, .brand-mark::after {
  position: absolute;
  content: "";
  inset: 9px;
  border: 1.5px solid var(--corn);
  border-radius: 50%;
}
.brand-mark::after { inset: 14px; }
.brand-name { font-weight: 760; line-height: 1.15; }
.brand-meta { color: var(--muted); font-size: .8rem; margin-top: .15rem; }
.shift-badge {
  border-radius: 999px;
  background: #ede9de;
  color: #524d40;
  padding: .42rem .64rem;
  white-space: nowrap;
  font-size: .75rem;
  font-weight: 750;
}
.shift-badge.is-open { background: #e1eddb; color: #2d5132; }

main { max-width: 1220px; margin: auto; padding: 0 clamp(1rem, 3vw, 2.25rem) 3rem; }
.startup-status { padding: 3rem 0; color: var(--muted); }
.dashboard { padding-top: clamp(1.35rem, 4vw, 3.2rem); }
.dashboard-heading, .section-heading, .cart-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.dashboard-heading { margin-bottom: 1.35rem; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 45px;
  padding: .65rem 1rem;
  border: 1px solid transparent;
  border-radius: .7rem;
  background: transparent;
  color: var(--ink);
  font-weight: 720;
  text-align: center;
  text-decoration: none;
  line-height: 1.2;
}
.button.compact { min-height: 38px; padding: .4rem .65rem; font-size: .83rem; }
.button.primary { color: white; background: var(--green); }
.button.primary:hover:not(:disabled) { background: var(--green-dark); }
.button.primary:disabled { color: #666a5e; background: #e7e7db; }
.button.secondary { border-color: #dcb85a; background: #f6d781; }
.button.secondary:hover:not(:disabled) { background: var(--corn); }
.button.quiet:hover:not(:disabled), .button.quiet:focus-visible { background: #efecdf; }
.button.quiet:disabled { opacity: .55; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 1rem; padding: clamp(1rem, 3vw, 1.4rem); }
.shift-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 1rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: .85rem;
  background: var(--line);
}
.shift-summary > div { display: grid; gap: .35rem; padding: .9rem clamp(.55rem, 2.3vw, 1.3rem); background: #eeebe0; }
.shift-summary span { color: #52584e; font-size: .79rem; line-height: 1.2; }
.shift-summary strong { font-size: clamp(.9rem, 2.3vw, 1.55rem); font-variant-numeric: tabular-nums; letter-spacing: -.035em; overflow-wrap: anywhere; }
.work-area { display: grid; gap: 1rem; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
.muted { color: var(--muted); font-size: .86rem; }
.catalogue > .muted { margin: .5rem 0 .85rem; }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); gap: .55rem; }
.product-button {
  text-align: left;
  min-height: 80px;
  display: grid;
  align-content: center;
  row-gap: .25rem;
  padding: .65rem .8rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
  color: var(--ink);
  background: #f8f6ee;
  overflow-wrap: anywhere;
}
.product-button:hover:not(:disabled), .product-button[aria-pressed="true"] { background: #eaf0e3; border-color: #678469; }
.product-button:disabled { opacity: .68; }
.product-button small { color: var(--muted); font-size: .82rem; }
.sale-item-form { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.sale-item-form .section-heading { margin-bottom: .65rem; }
.choice { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .8rem; padding: 0; border: 0; }
.choice label { position: relative; cursor: pointer; }
.choice legend, .field-label { display: block; margin-bottom: .4rem; font-weight: 660; font-size: .82rem; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice span {
  display: block;
  padding: .55rem .68rem;
  border-radius: .55rem;
  border: 1px solid var(--line);
  color: #454f44;
  font-size: .82rem;
  font-weight: 660;
}
.choice input:checked + span { border-color: #617c63; background: #e6efe1; color: #243f2b; }
.choice input:focus-visible + span { outline: 3px solid #92681f; outline-offset: 2px; }
.inline-field { display: flex; gap: .55rem; }
.inline-field .button { flex: 0 0 auto; }
input:not([type="radio"]), select {
  display: block;
  min-width: 0;
  width: 100%;
  min-height: 45px;
  padding: .62rem .7rem;
  background: #fffefa;
  border: 1px solid #a7aa9d;
  border-radius: .55rem;
  color: var(--ink);
}
.quick-amounts { margin-top: .5rem; display: flex; gap: .1rem; flex-wrap: wrap; }
.cart-items, .history-list, .ticket-items { list-style: none; margin: .65rem 0 0; padding: 0; }
.cart-row, .history-row, .ticket-row { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .65rem 0; border-bottom: 1px solid var(--line); }
.cart-row-main, .history-row-main { min-width: 0; overflow-wrap: anywhere; }
.cart-row-actions { flex: 0 0 auto; display: flex; align-items: center; gap: .15rem; }
.cart-row-actions .button { min-width: 38px; font-size: 1.1rem; }
.cart-total { border-top: 1px solid var(--line); margin: .75rem 0 1rem; padding-top: .85rem; }
.cart-total strong { font-size: 1.6rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cart-items:not([hidden]) + .cart-total { border: 0; padding-top: 0; }
.empty { padding: 1.1rem 0 .55rem; color: var(--muted); font-size: .9rem; }
.history, .last-close { margin-top: 1rem; }
.history-row:last-child { border-bottom: 0; padding-bottom: 0; }
.history-row .button { min-width: 92px; }
.history-row .muted, .cart-row .muted { margin-top: .2rem; }
.charge { width: 100%; margin-top: .15rem; }
.cash-change { margin: .3rem 0 .65rem; }
.cash-change p:empty { display: none; }
.cash-change p { margin-top: .4rem; }
.feedback { margin-bottom: 1rem; padding: .75rem .85rem; border: 1px solid #a3b9a1; border-radius: .65rem; background: #eaf0e3; }
.feedback.error { color: #802621; border-color: #d3a39c; background: #faece7; }
.error-text { color: var(--danger); font-size: .85rem; }
.login-wrap { display: grid; align-items: stretch; grid-template-columns: 1.05fr 1fr; max-width: 825px; margin: clamp(2rem, 10vh, 6rem) auto 0; gap: 1rem; }
.login-note {
  position: relative;
  display: grid;
  align-content: end;
  gap: .7rem;
  min-height: 420px;
  overflow: hidden;
  padding: clamp(1.15rem, 3.5vw, 2.1rem);
  border-radius: 1rem;
  color: #faf5e4;
  background: var(--green);
}
.login-note h1 { font-size: clamp(2.4rem, 6vw, 3.85rem); }
.login-note p { max-width: 16rem; }
.login-art { position: absolute; top: 1.3rem; right: 1rem; width: 45%; max-width: 175px; aspect-ratio: 1; transform: rotate(-18deg); }
.login-art span { position: absolute; width: 75%; aspect-ratio: 1; border-radius: 50%; border: 1px solid #f1cf75; }
.login-art span:nth-child(2) { top: 10%; left: 10%; }
.login-art span:nth-child(3) { top: 20%; left: 20%; }
.login-form { display: grid; align-content: center; gap: .55rem; padding: clamp(1.15rem, 3.5vw, 2.1rem); }
.login-form h2 { margin-bottom: .45rem; font-size: 1.65rem; }
.login-form label, .dialog-form label { font-size: .88rem; font-weight: 660; }
.login-form select, .login-form input { margin-bottom: .25rem; }
.login-form .primary { margin-top: .35rem; }

dialog {
  width: min(calc(100% - 2rem), 420px);
  max-height: calc(100% - 2rem);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--paper);
  color: var(--ink);
}
dialog::backdrop { background: #18281fb0; }
.dialog-form { padding: 1.25rem; display: grid; gap: .7rem; }
.dialog-form h2 { margin-bottom: .2rem; }
.dialog-actions { display: flex; justify-content: end; flex-wrap: wrap; gap: .5rem; margin-top: .45rem; }
.receipt-summary { display: grid; gap: .6rem; margin: .75rem 0 0; }
.receipt-summary div { display: flex; justify-content: space-between; gap: .7rem; }
.receipt-summary dt { color: var(--muted); }
.receipt-summary dd { margin: 0; font-weight: 740; }
@media (max-width: 750px) {
  .work-area { grid-template-columns: minmax(0, 1fr); }
  .login-note { min-height: 340px; }
}
@media (max-width: 550px) {
  .login-wrap { grid-template-columns: minmax(0, 1fr); margin-top: 1rem; }
  .login-note { min-height: 220px; }
  .login-art { max-width: 106px; top: .75rem; }
  .header-actions { gap: .3rem; }
}
@media (max-width: 340px) {
  .shift-badge { display: none; }
  .inline-field { flex-wrap: wrap; }
  .inline-field .button { flex: 1; }
}
@media print {
  body { min-width: auto; background: #fff; color: #000; }
  body > :not(#ticket-dialog), #ticket-dialog .dialog-actions { display: none !important; }
  #ticket-dialog[open] { display: block; position: static; width: 72mm; max-height: none; max-width: 100%; padding: 0; border: 0; border-radius: 0; margin: 0; color: #000; background: #fff; }
  #ticket-dialog::backdrop { display: none; }
  #ticket-dialog .ticket-body { padding: 0; }
}

.connection-status {
  margin-bottom: 1rem;
  padding: .75rem .85rem;
  border: 1px solid #cbb66b;
  border-radius: .65rem;
  background: #fbf0ce;
  color: #51451e;
  line-height: 1.4;
}
.pending { margin-top: 1rem; }
.pending .section-heading { margin-bottom: .55rem; }
.pending .history-row { flex-wrap: wrap; }
.pending-error { color: var(--danger); font-size: .82rem; margin-top: .3rem; }
.ticket-note { padding: .55rem .65rem; border: 1px solid currentColor; border-radius: .45rem; font-weight: 660; }
