:root {
  --ink: #16171c;
  --ink-muted: #6e6a63;
  --paper: #f7f5f0;
  --surface: #ffffff;
  --line: #e7e2d8;
  --accent: #f0a93a;
  --accent-deep: #a86a17;
  --accent-ink: #16171c;
  --danger: #c23b2b;
  --danger-bg: #fbeae6;

  --font-display: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Corner-cut motif — echoes the mitred diamond in the wordmark. Applied as
     a family of three sizes so every surface reads as one visual system. */
  --cut-lg: 18px;
  --cut: 12px;
  --cut-sm: 8px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overscroll-behavior: none;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#app {
  height: 100vh;
  width: 100vw;
  position: relative;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  background: var(--paper);
}

.screen.active {
  display: flex;
}

/* ---------- Home ---------- */

.screen--home {
  align-items: stretch;
  overflow: hidden;
}

.home-hero {
  flex-shrink: 0;
  height: 30vh;
  min-height: 200px;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 76%);
}

.home-content {
  flex: 1;
  width: 100%;
  padding: 0 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
  margin-top: -13vh;
  padding-bottom: 6vh;
}

.home-logo {
  width: min(360px, 70vw);
  height: auto;
}

.home-content h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 800;
  color: var(--ink);
}

/* ---------- Shared screen chrome ---------- */

.screen-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
}

.screen-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 32px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.screen-body h2 {
  font-family: var(--font-display);
  font-size: clamp(24px, 3.5vw, 34px);
  font-weight: 800;
  margin: 12px 0 28px;
  text-align: center;
}

.steps {
  display: flex;
  gap: 8px;
  margin: 0 auto;
  padding-right: 44px; /* balance the back button width */
  flex: 1;
  justify-content: center;
}

.step {
  width: 34px;
  height: 4px;
  background: var(--line);
}

.step.active { background: var(--accent); }
.step.done { background: var(--accent-deep); opacity: 0.55; }

/* ---------- Buttons ---------- */

.btn {
  border: none;
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  padding: 18px 28px;
}

.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn--primary:disabled {
  background: var(--line);
  color: var(--ink-muted);
  cursor: default;
}

.btn--secondary {
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--ink);
}

.btn--xl {
  width: min(420px, 100%);
  font-size: 19px;
  padding: 22px 28px;
}

.btn-icon {
  width: 44px;
  height: 44px;
  clip-path: polygon(var(--cut-sm) 0, 100% 0, 100% calc(100% - var(--cut-sm)), calc(100% - var(--cut-sm)) 100%, 0 100%, 0 var(--cut-sm));
  border: none;
  background: var(--surface);
  color: var(--ink);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-icon--round {
  width: 64px;
  height: 64px;
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  font-size: 28px;
  background: var(--surface);
  border: 2px solid var(--line);
}

/* ---------- Person search ---------- */

.search-input {
  width: min(560px, 100%);
  font-family: var(--font-body);
  font-size: 22px;
  font-weight: 600;
  padding: 20px 22px;
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  border: 2px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

.search-input::placeholder {
  color: var(--ink-muted);
  font-weight: 500;
}

.search-input:focus {
  border-color: var(--accent);
}

.result-list {
  width: min(560px, 100%);
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-item {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  padding: 16px 20px;
  cursor: pointer;
}

.result-item .name {
  display: block;
  font-size: 18px;
  font-weight: 700;
}

.result-item .customer {
  display: block;
  font-size: 14px;
  color: var(--ink-muted);
  font-weight: 500;
  margin-top: 2px;
}

.hint {
  color: var(--ink-muted);
  margin-top: 20px;
}

/* ---------- Product grid ---------- */

.product-grid {
  width: 100%;
  max-width: 720px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--line);
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  padding: 24px 16px;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  text-align: center;
}

.product-card .name {
  font-size: 17px;
  font-weight: 700;
}

.product-card .price {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-muted);
}

.product-card .stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 4px;
}

.product-card .stepper-minus,
.product-card .stepper-qty {
  display: none;
}

.product-card.qty-active .stepper-minus,
.product-card.qty-active .stepper-qty {
  display: flex;
}

.product-card .stepper-minus,
.product-card .stepper-plus {
  width: 40px;
  height: 40px;
  font-size: 20px;
}

.product-card .stepper-qty {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  min-width: 24px;
  text-align: center;
  align-items: center;
  justify-content: center;
}

.product-card.qty-active {
  border-color: var(--accent);
  background: #fef8ee;
}

.product-card.locked {
  opacity: 0.6;
}

.product-card.locked .stepper-plus,
.product-card.locked .stepper-minus {
  cursor: default;
}

/* ---------- Cart bar (sacola) ---------- */

.cart-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.cart-bar-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.cart-bar-icon {
  color: var(--accent-deep);
  flex-shrink: 0;
}

.cart-bar .btn {
  padding: 14px 24px;
  font-size: 16px;
}

/* ---------- Cart review (sacola) ---------- */

.cart-list {
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
}

.cart-row {
  background: var(--surface);
  border: 1px solid var(--line);
  clip-path: polygon(var(--cut-sm) 0, 100% 0, 100% calc(100% - var(--cut-sm)), calc(100% - var(--cut-sm)) 100%, 0 100%, 0 var(--cut-sm));
  padding: 14px 18px;
}

.cart-row-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cart-row-name {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
}

.cart-row-qty {
  color: var(--ink-muted);
  font-weight: 500;
}

.cart-row-subtotal {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-muted);
  white-space: nowrap;
}

.cart-remove {
  border: none;
  background: transparent;
  color: var(--danger);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}

.cart-status {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-muted);
  white-space: nowrap;
}

.cart-status--ok {
  color: var(--accent-deep);
  font-weight: 700;
}

.cart-row-error {
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 14px;
  font-weight: 600;
}

.summary-card {
  width: min(480px, 100%);
  background: var(--surface);
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  border: 1px solid var(--line);
  padding: 8px 24px;
  margin-bottom: 28px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
  font-weight: 600;
}

.summary-row:last-child { border-bottom: none; }

.summary-row span { color: var(--ink-muted); font-weight: 500; }

.summary-row--total strong {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
}

.error-text {
  color: var(--danger);
  background: var(--danger-bg);
  font-weight: 600;
  padding: 12px 18px;
  clip-path: polygon(var(--cut-sm) 0, 100% 0, 100% calc(100% - var(--cut-sm)), calc(100% - var(--cut-sm)) 100%, 0 100%, 0 var(--cut-sm));
  margin-top: 16px;
  width: min(480px, 100%);
  text-align: center;
}

/* ---------- Success ---------- */

#screen-success {
  align-items: center;
  justify-content: center;
}

.result-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px;
}

.check-mark {
  width: 84px;
  height: 84px;
  clip-path: polygon(var(--cut-lg) 0, 100% 0, 100% calc(100% - var(--cut-lg)), calc(100% - var(--cut-lg)) 100%, 0 100%, 0 var(--cut-lg));
  background: var(--ink);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.result-content h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
}

.result-product {
  font-size: 19px;
  font-weight: 700;
  margin: 4px 0 0;
}

.result-qty {
  color: var(--ink-muted);
  font-weight: 600;
  margin: 0 0 20px;
}

.result-person p {
  margin: 2px 0;
  font-weight: 600;
}

.muted { color: var(--ink-muted); font-weight: 500; }

.result-content .btn { margin-top: 24px; }

.success-items {
  margin: 4px 0 0;
}

.success-items .result-product {
  font-size: 17px;
  margin: 2px 0;
}

.hidden { display: none !important; }
