:root {
  --green-950: #073d30;
  --green-900: #0b4a39;
  --green-800: #155f4c;
  --green-700: #2d7965;
  --green-100: #e7f2ee;
  --gold: #ffc62e;
  --gold-deep: #ecab00;
  --red: #df4054;
  --ink: #1f2933;
  --muted: #69747d;
  --line: #dce2e5;
  --surface: #ffffff;
  --surface-soft: #f4f6f7;
  --shadow: 0 14px 34px rgba(12, 52, 43, .12);
  --radius: 16px;
  font-family: system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  background: #eef2f1;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 15%, rgba(30, 110, 88, .08), transparent 24rem),
    radial-gradient(circle at 90% 85%, rgba(255, 198, 46, .10), transparent 24rem),
    #f5f7f6;
}

button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
input { width: 100%; }

.app-shell {
  width: min(1120px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 16px 40px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 64px;
  display: grid;
  grid-template-columns: 44px minmax(130px, 1fr) auto 44px;
  align-items: center;
  gap: 10px;
  color: white;
  background: linear-gradient(135deg, var(--green-950), var(--green-800));
  box-shadow: 0 8px 24px rgba(7, 61, 48, .2);
  padding: 8px 12px;
}

.icon-button {
  border: 0;
  background: transparent;
  color: white;
  font-size: 29px;
  line-height: 1;
  border-radius: 10px;
  height: 42px;
}
.icon-button:hover { background: rgba(255,255,255,.1); }

.profile-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  max-width: 100%;
  border-radius: 999px;
  background: #f1e7ff;
  color: #14151a;
  padding: 5px 10px 5px 6px;
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
}
.profile-pill span:last-child {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.profile-avatar {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
  border-radius: 50%;
  background: white;
  color: var(--green-900);
}

.brand {
  color: var(--gold);
  text-decoration: none;
  font-size: clamp(18px, 3vw, 28px);
  font-weight: 900;
  letter-spacing: -.7px;
  white-space: nowrap;
}
.brand-mark { display: inline-block; transform: rotate(-20deg); }
.brand small { font-size: 9px; letter-spacing: .7px; color: white; }

.lottery-selector-card {
  margin: 22px 0 10px;
  border: 1px solid rgba(10, 76, 59, .08);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 15px;
}
.lottery-selector-heading {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px;
}
.lottery-selector-heading h1 { margin: 3px 0 0; color: var(--green-950); font-size: 20px; }
.lottery-count { border-radius: 999px; background: var(--green-100); color: var(--green-900); padding: 6px 10px; font-size: 12px; font-weight: 850; }
.lottery-selector { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.lottery-option {
  min-height: 62px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 9px;
  border: 1.5px solid var(--line); border-radius: 11px; background: var(--surface-soft); color: var(--ink);
  padding: 9px 11px; text-align: left; font-weight: 850;
}
.lottery-option .flag { font-size: 24px; }
.lottery-option small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 650; }
.lottery-option.active { border-color: var(--green-700); background: linear-gradient(135deg, var(--green-900), var(--green-700)); color: white; }
.lottery-option.active small { color: rgba(255,255,255,.72); }
.selector-help { margin: 10px 0 0; color: var(--muted); font-size: 12px; }

.lottery-banner {
  margin: 22px 0 10px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: white;
  background: linear-gradient(135deg, var(--green-700), var(--green-900));
  border-radius: 10px;
  padding: 10px 16px;
  box-shadow: var(--shadow);
}
.lottery-banner strong { font-size: 22px; }
.lottery-banner small {
  color: rgba(255,255,255,.75);
  border-left: 1px solid rgba(255,255,255,.3);
  padding-left: 10px;
}

.demo-notice {
  margin-bottom: 12px;
  border: 1px solid #f2d471;
  background: #fff8dd;
  color: #654d00;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  text-align: center;
}

.step-panel { display: none; }
.step-panel.active { display: block; }

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 14px;
  align-items: start;
}

.main-card, .cart-card, .summary-card, .success-card {
  background: var(--surface);
  border: 1px solid rgba(10, 76, 59, .08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.main-card { padding: 14px; }
.cart-card {
  position: sticky;
  top: 82px;
  overflow: hidden;
}

.tab-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-soft);
}
.tab {
  min-height: 44px;
  border: 0;
  background: transparent;
  font-weight: 750;
}
.tab.active { background: var(--gold); color: #fff; }

.bet-type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}
.bet-type-button {
  position: relative;
  min-height: 48px;
  border: 1.5px solid var(--green-700);
  border-radius: 11px;
  background: white;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
}
.bet-type-button.active {
  background: var(--green-700);
  color: white;
}
.rate-chip {
  position: absolute;
  right: 6px;
  top: -8px;
  border-radius: 999px;
  background: var(--green-700);
  color: white;
  font-size: 12px;
  padding: 2px 7px;
}
.bet-type-button.active .rate-chip { background: #f8fdff; color: var(--green-900); }

.number-entry {
  padding: 8px 0 4px;
  text-align: center;
}
.digit-boxes {
  min-height: 58px;
  display: flex;
  justify-content: center;
  gap: 7px;
}
.digit-box {
  width: 50px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--green-900);
  border-radius: 7px;
  background: var(--surface-soft);
  font-size: 25px;
  font-weight: 900;
}
.entry-help { margin: 7px 0 0; color: var(--muted); font-size: 12px; }

.number-tools {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 8px;
  margin: 8px 0;
}
.tool-button {
  min-height: 42px;
  border: 0;
  border-radius: 9px;
  background: #e5e9eb;
  font-weight: 800;
}
.tool-button.primary { background: var(--green-800); color: white; }

.quick-number-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-bottom: 6px;
}
.quick-number-grid button {
  min-height: 39px;
  border: 1px solid var(--gold-deep);
  border-radius: 7px;
  background: white;
  font-weight: 750;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}
.keypad button {
  min-height: 56px;
  border: 0;
  border-radius: 8px;
  background: var(--gold);
  color: white;
  font-size: 24px;
  font-weight: 900;
}
.keypad button:active { transform: translateY(1px); }
.keypad .key-secondary { background: #e6eaec; color: #111; font-size: 16px; }

.cart-header {
  background: var(--green-700);
  color: white;
  padding: 15px;
}
.cart-header > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cart-header strong {
  display: grid;
  place-items: center;
  min-width: 48px;
  height: 28px;
  border-radius: 8px;
  background: white;
  color: var(--green-950);
}
.danger-link {
  display: block;
  margin: 10px auto 0;
  border: 0;
  border-radius: 999px;
  background: var(--red);
  color: white;
  padding: 6px 12px;
  font-size: 12px;
}

.cart-list {
  max-height: 470px;
  overflow-y: auto;
  padding: 10px;
}
.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 40px 10px;
}
.cart-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px;
  margin-bottom: 8px;
}
.cart-item-title {
  font-weight: 800;
  color: var(--green-900);
}
.cart-item-number {
  font-size: 21px;
  font-weight: 900;
  color: #4234d6;
}
.cart-item button {
  align-self: center;
  border: 0;
  border-radius: 7px;
  background: #ffe0e4;
  color: var(--red);
  width: 34px;
  height: 34px;
}
.cart-footer {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 10px;
}

.primary-button, .secondary-button {
  min-height: 48px;
  border: 0;
  border-radius: 9px;
  font-weight: 900;
}
.primary-button {
  background: linear-gradient(135deg, var(--green-900), var(--green-700));
  color: white;
}
.secondary-button {
  background: var(--gold);
  color: white;
}
.primary-button.full { width: 100%; }

.summary-card {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: clamp(16px, 3vw, 28px);
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 20px;
}
.section-heading h1 {
  margin: 4px 0;
  color: var(--green-950);
}
.section-heading p { margin: 0; color: var(--muted); }
.eyebrow {
  color: var(--green-700);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .5px;
}
.status-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--green-100);
  color: var(--green-900);
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 800;
}
.status-badge.warning { background: #fff1c2; color: #7b5700; }

.customer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.customer-grid label, .equal-price-row label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}
.customer-grid input, .equal-price-row input {
  margin-top: 6px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  outline: none;
}
.customer-grid input:focus, .equal-price-row input:focus {
  border-color: var(--green-700);
  box-shadow: 0 0 0 3px rgba(45,121,101,.12);
}

.price-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.price-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 660px;
}
.price-table th, .price-table td {
  padding: 12px 10px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}
.price-table th {
  color: var(--muted);
  font-size: 13px;
  background: var(--surface-soft);
}
.price-table tbody tr:last-child td { border-bottom: 0; }
.price-number {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.price-number strong {
  border-radius: 6px;
  background: var(--green-700);
  color: white;
  padding: 6px 12px;
  min-width: 72px;
}
.amount-input {
  width: 100px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px;
  text-align: center;
}
.table-delete {
  border: 0;
  border-radius: 7px;
  background: #ffe2e5;
  color: var(--red);
  width: 36px;
  height: 36px;
}

.equal-price-row {
  display: grid;
  grid-template-columns: minmax(160px, 260px) auto;
  justify-content: end;
  align-items: end;
  gap: 10px;
  margin: 18px 0;
}
.totals-box {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-radius: 12px;
  background: var(--surface-soft);
  padding: 12px;
  gap: 8px;
}
.totals-box > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 12px;
}
.totals-box span { color: var(--muted); font-size: 13px; }
.totals-box strong { color: var(--green-900); font-size: 18px; }
.totals-box.emphasis {
  grid-template-columns: 1fr 1fr;
  background: #eef7f3;
  margin-top: 16px;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
  margin-top: 20px;
}

.confirm-customer {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--surface-soft);
}
.confirm-customer strong { color: var(--green-900); }
.confirm-list { display: grid; gap: 8px; }
.confirm-item {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 90px 90px 130px;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
}
.confirm-item .number {
  color: #4234d6;
  font-size: 22px;
  font-weight: 900;
}
.confirm-checkbox {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid #ebca62;
  border-radius: 10px;
  background: #fff8dd;
  margin-top: 18px;
  padding: 13px;
  cursor: pointer;
}
.confirm-checkbox input {
  width: 19px;
  height: 19px;
  margin: 1px 0 0;
  accent-color: var(--green-800);
}

.error-box {
  margin-top: 12px;
  border: 1px solid #ef9da8;
  background: #fff0f2;
  color: #8e1e2d;
  border-radius: 9px;
  padding: 10px 12px;
}

.success-card {
  width: min(620px, 100%);
  margin: 25px auto;
  padding: 34px;
  text-align: center;
}
.success-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--green-100);
  color: var(--green-800);
  font-size: 38px;
  font-weight: 900;
}
.success-card h1 { color: var(--green-950); margin: 6px 0; }
.success-card p { color: var(--muted); }
.order-id-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 10px 0 18px;
}
.order-id-row code {
  border: 1px dashed var(--green-700);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px 12px;
  font-size: 16px;
}
.order-id-row button {
  border: 0;
  border-radius: 8px;
  background: var(--gold);
  font-weight: 800;
}
.success-summary {
  border-radius: 12px;
  background: var(--surface-soft);
  margin-bottom: 18px;
  padding: 15px;
  text-align: left;
}
.success-summary div {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 5px 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  background: #17211e;
  color: white;
  border-radius: 999px;
  padding: 10px 16px;
  transition: .2s ease;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 820px) {
  .layout-grid { grid-template-columns: 1fr; }
  .cart-card { position: static; }
  .cart-list { max-height: 260px; }
  .lottery-banner small { display: none; }
}

@media (max-width: 760px) {
  .lottery-selector { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .app-shell { padding-inline: 0; }
  .topbar { grid-template-columns: 38px minmax(90px, 1fr) auto 38px; }
  .profile-pill { font-size: 11px; padding-right: 7px; }
  .brand { font-size: 18px; }
  main { padding: 0 10px 28px; }
  .lottery-banner { margin-top: 12px; }
  .main-card { padding: 10px; }
  .bet-type-grid { gap: 6px; }
  .bet-type-button { font-size: 16px; min-height: 45px; }
  .keypad button { min-height: 53px; }
  .customer-grid { grid-template-columns: 1fr; }
  .section-heading { display: block; }
  .status-badge { display: inline-block; margin-top: 10px; }
  .equal-price-row { grid-template-columns: 1fr 1fr; justify-content: stretch; }
  .totals-box { grid-template-columns: 1fr; }
  .totals-box.emphasis { grid-template-columns: 1fr; }
  .confirm-item {
    grid-template-columns: 1fr 1fr;
  }
  .confirm-item .number { text-align: right; }
  .action-row { grid-template-columns: 1fr; }
  .success-card { padding: 24px 16px; }
}
