:root {
  --bg: #fff8ef;
  --card: #ffffff;
  --ink: #3a2419;
  --accent: #c2410c;
  --accent-dark: #9a3412;
  --border: #e7d9c9;
  --muted: #8a7362;
  --received: #6b7280;
  --confirmed: #b45309;
  --placed: #15803d;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  margin: 0;
  padding: 0;
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.wrap.wide { max-width: 1100px; }

h1 {
  font-size: 1.9rem;
  margin-bottom: 4px;
}

h1 .emoji { font-size: 1.5rem; }

.subtitle {
  color: var(--muted);
  margin-top: 0;
  margin-bottom: 24px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 18px;
  padding: 14px 16px;
}

legend {
  font-weight: 600;
  padding: 0 6px;
}

.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  gap: 10px;
}
.option-row:last-child { border-bottom: none; }

.option-label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.price-tag {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

input[type="text"], input[type="search"], input[type="email"], input[type="password"], input[type="number"], textarea, select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}

label.field-label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.field { margin-bottom: 16px; }

button, .btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  font-weight: 600;
}
button:hover, .btn:hover { background: var(--accent-dark); }
button.secondary, .btn.secondary { background: #6b7280; }
button.small, .btn.small { padding: 4px 8px; font-size: 0.78rem; }
button.danger, .btn.danger { background: #b91c1c; }

.total-bar {
  position: sticky;
  bottom: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
}

.total-amount { font-size: 1.4rem; font-weight: 700; }

.error-box {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
th, td {
  text-align: left;
  padding: 5px 7px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th { color: var(--muted); font-weight: 600; }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
}
.badge.received { background: var(--received); }
.badge.confirmed { background: var(--confirmed); }
.badge.placed { background: var(--placed); }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.topbar a { color: var(--accent); text-decoration: none; font-weight: 600; }

.item-list { margin: 0; padding-left: 14px; }
.item-list li { margin-bottom: 1px; }

.grand-total {
  font-size: 1.1rem;
  font-weight: 700;
}

.muted { color: var(--muted); }

.menu-group {
  margin: 26px 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--border);
  font-size: 1.2rem;
}

.menu-tools { margin-bottom: 16px; }
.menu-tools input[type=search] { width: 100%; margin-bottom: 10px; }
.group-links { display: flex; flex-wrap: wrap; gap: 6px; }
.menu-section { scroll-margin-top: 12px; }
.group-chip {
  display: inline-block;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font-size: 0.85rem;
  text-decoration: none;
  white-space: nowrap;
}
.group-chip:hover { border-color: var(--accent); color: var(--accent); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.stat-num { font-size: 1.5rem; font-weight: 700; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 0 16px; }

.preview-bar { background: #1f2937; color: #fff; padding: 8px 16px; text-align: center; font-size: 0.9rem; }
.preview-bar a { color: #fde68a; }
.admin-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.admin-tools details { flex-basis: 100%; }
.admin-tools details:not([open]) { flex-basis: auto; }
.admin-tools summary { list-style: none; display: inline-block; }
.admin-tools summary::-webkit-details-marker { display: none; }
.quick-edit { display: grid; gap: 8px; margin-top: 8px; max-width: 480px; }
.quick-edit label { font-size: 0.85rem; font-weight: 600; display: grid; gap: 3px; }
.quick-edit.inline { display: flex; flex-wrap: wrap; align-items: center; max-width: none; }
.quick-edit.inline input[type=text] { width: 200px; }
.item-tools { flex-basis: auto; margin-left: 10px; }
.item-tools[open] { flex-basis: 100%; margin-left: 0; }
.item-tools summary { padding: 0 2px; }
.item-tools summary { cursor: pointer; color: var(--muted, #6b7280); list-style: none; font-size: 0.85rem; }
.item-tools summary::-webkit-details-marker { display: none; }
.option-row { flex-wrap: wrap; }
.is-hidden { opacity: 0.55; }

.order-line { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--border); }
.row-actions { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.row-actions .btn, .row-actions button { display: block; width: 100%; text-align: center; padding: 7px 12px; white-space: nowrap; box-sizing: border-box; }
.row-actions form { margin: 0; }
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0 16px; align-items: start; }
.pay-reminder { background: #fef9c3; border: 1px solid #fde68a; border-radius: 10px; padding: 12px 14px; margin: 4px 0 14px; line-height: 1.45; color: #422006; }
.option-row > :nth-child(2) { margin-left: auto; }
.menu-group { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.to-top { font-size: 0.8rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
html { scroll-behavior: smooth; }

.email-toggles { display: flex; flex-direction: column; gap: 2px; font-size: 0.8rem; white-space: nowrap; }
.email-toggles label { display: flex; gap: 5px; align-items: center; font-weight: 400; }
.check-row { display: flex; gap: 8px; align-items: center; margin: 6px 0; font-weight: 400; }

.pay-card { text-align: center; }
.pay-btn { display: inline-block; font-size: 1.1rem; padding: 12px 22px; text-decoration: none; background: #008cff; }
.pay-btn:hover { background: #0074d4; }
.pay-field { display: flex; gap: 4px; align-items: center; font-size: 0.85rem; font-weight: 400; }
.pm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.pm-grid .card { margin: 0; }
.pm-card-head { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.pm-card-head form { margin: 0; }
.pm-form { display: grid; gap: 10px; }
.pm-form label { display: grid; gap: 4px; font-size: 0.85rem; font-weight: 600; }
.pm-form label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.pm-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pm-form button { justify-self: start; }
.pm-actions { display: flex; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); }
.pm-actions form { margin: 0; }
.row-actions .pay-btn { font-size: 0.8rem; }

.pricing-top { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; justify-content: space-between; }
.pricing-stats { font-size: 0.9rem; }
.pricing-buttons { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pct-pair { display: inline-flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.pct-pair label { display: inline-flex; gap: 6px; align-items: center; font-size: 0.85rem; font-weight: 600; }
input.pct { width: 110px; padding: 4px 6px; font-size: 0.85rem; }
.pricing-group-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; }
.pricing-group details { margin-top: 8px; }
.pricing-group summary { cursor: pointer; font-size: 0.85rem; }
.pricing-table td.num, .pricing-table th.num { text-align: right; white-space: nowrap; }
.pricing-table .p-row td { border-top: 2px solid var(--border); padding-top: 8px; }
.pricing-table .c-row td { font-size: 0.85rem; font-weight: 600; }
.pricing-table .i-row td { font-size: 0.82rem; }
.price-new { color: #b45309; }
.item-table { width: 100%; }
.item-table th, .item-table td { vertical-align: middle; }
.item-table td:nth-child(2) input { width: 100%; min-width: 140px; }
.item-table td.num input { width: 90px; text-align: right; }
.item-table th.num { text-align: right; }
.item-actions { display: flex; gap: 6px; flex-wrap: nowrap; align-items: center; }
.item-actions form { margin: 0; }

.pricing-row { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin: -8px 0 14px; padding: 8px 10px; background: #f8fafc; border: 1px dashed var(--border); border-radius: 8px; font-size: 0.85rem; }
.pricing-row label { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }
.item-table input.pct { width: 100px; }
.group-markups { margin-top: 8px; }
.group-markups summary { cursor: pointer; font-size: 0.85rem; }
.group-markups table { margin-top: 6px; }
.in-cart { margin: 0; text-align: center; }
.in-cart input[type=checkbox] { width: 18px; height: 18px; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
