:root {
  --green: #276349;
  --ink: #243b30;
  --muted: #7a8279;
  --line: #e1e5da;
  --cream: #f7f8f2;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font:
    15px/1.6 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Microsoft JhengHei",
    sans-serif;
}
header {
  height: 88px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1120px) / 2));
}
.brand {
  font-size: 23px;
  font-weight: 800;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 1px;
}
.brand small {
  display: block;
  font-size: 9px;
  letter-spacing: 3px;
  margin-left: 35px;
}
main {
  max-width: 1120px;
  margin: auto;
  padding: 24px;
}
.notice {
  background: #f0ead7;
  border: 1px solid #e1d5b5;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
}
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 44px 12px 30px;
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--green);
  font-weight: 700;
}
h1 {
  font-size: 46px;
  line-height: 1.35;
  letter-spacing: 2px;
  margin: 14px 0;
}
h2 {
  font-size: 21px;
  margin: 0 0 16px;
}
.heroicon {
  font-size: 130px;
  background: #e8eddc;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transform: rotate(-9deg);
}
.muted,
.hint {
  color: var(--muted);
}
.session {
  background: #e7eedf;
  border-radius: 16px;
  padding: 25px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.session h2 {
  margin: 4px 0 0;
  font-size: 26px;
}
.session p {
  font-size: 13px;
  margin: 8px 0 0;
}
.badge {
  display: inline-block;
  background: white;
  color: var(--green);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 13px;
}
nav {
  display: flex;
  gap: 24px;
  margin: 28px 0 22px;
  border-bottom: 1px solid var(--line);
}
nav button {
  border: 0;
  background: none;
  padding: 12px 2px;
  border-bottom: 3px solid transparent;
  border-radius: 0;
}
nav button.active {
  color: var(--green);
  border-color: var(--green);
  font-weight: bold;
}
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr);
  gap: 25px;
}
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 22px;
}
.sectiontitle {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sectiontitle span {
  font-size: 12px;
}
.meal {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.meal:last-child {
  border: 0;
}
.custom-meal {
  border-top: 1px solid var(--line);
}
.custom-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 10px;
}
.custom-fields label {
  margin: 4px 0 12px;
}
.custom-fields input {
  padding: 8px;
  min-width: 0;
}
.custom-meal .mealinfo span {
  font-size: 12px;
}
.mealinfo {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.mealinfo b {
  font-size: 15px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.mealinfo p {
  margin: 0;
  color: var(--green);
  font-size: 14px;
  white-space: nowrap;
}
.stepper {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.stepper button {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
}
.stepper output {
  min-width: 20px;
  text-align: center;
}
button {
  font: inherit;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
}
button:hover {
  background: #edf2e8;
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.primary {
  background: var(--green);
  color: white;
  border: 0;
  width: 100%;
  padding: 13px;
  font-weight: 700;
}
.primary:hover {
  background: #194832;
}
.quiet {
  background: transparent;
  font-size: 13px;
}
.total {
  display: flex;
  justify-content: space-between;
  padding: 19px 0;
}
.total strong {
  font-size: 24px;
  color: var(--green);
}
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.photo-thumbnail {
  padding: 8px;
  background: #faf9f5;
  cursor: zoom-in;
}
.photo-thumbnail img {
  display: block;
  width: 100%;
  height: 280px;
  object-fit: contain;
}
#photoViewer {
  width: min(960px, 94vw);
  max-width: 94vw;
  max-height: 90vh;
  overflow: auto;
  border: none;
  border-radius: 16px;
  padding: 18px;
}
#photoViewer::backdrop {
  background: #000b;
}
.photo-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: -18px;
  background: white;
  padding: 8px 0;
}
.photo-toolbar h2 {
  font-size: 18px;
  margin: 0;
}
#closePhoto {
  flex-shrink: 0;
}
#photoLarge {
  display: block;
  width: 100%;
  height: auto;
}
#settlementDialog {
  width: min(540px, 94vw);
  max-width: 94vw;
  max-height: 92vh;
  overflow: auto;
  border: none;
  border-radius: 18px;
  padding: 20px;
}
#settlementDialog::backdrop {
  background: #000b;
}
.banknotes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.banknotes button {
  border: 2px solid currentColor;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 800;
  padding: 6px 4px;
  box-shadow: inset 0 0 0 3px #ffffff80;
}
.banknotes small {
  display: block;
  font-size: 12px;
  margin-top: 4px;
}
.note-blue {
  background: #dcedfb;
  color: #22598a;
}
.note-brown {
  background: #eadbd1;
  color: #79553f;
}
.note-red {
  background: #f9dcdf;
  color: #9c3744;
}
.settlement-due {
  font-size: 20px;
}
.change-result {
  display: block;
  margin: 18px 0;
  padding: 18px;
  background: #e6f2e9;
  border-radius: 12px;
  color: #174c30;
  font-size: 26px;
  font-weight: 700;
}
.payment-warning {
  color: #a3421e;
  font-weight: 600;
}
#adminPaymentOrders {
  max-height: 540px;
  overflow: auto;
  margin-bottom: 24px;
}
.rice-option {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.rice-option input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: #276349;
}
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 16px 0;
}
input,
textarea,
select {
  width: 100%;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfcf9;
  color: var(--ink);
  font: inherit;
  margin-top: 6px;
}
textarea {
  resize: vertical;
  min-height: 76px;
}
.hint {
  font-size: 12px;
  text-align: center;
  margin-bottom: 0;
}
.metrics {
  display: flex;
  gap: 40px;
  margin: 15px 0;
}
.metrics strong {
  display: block;
  font-size: 29px;
}
.metrics span {
  color: var(--muted);
  font-size: 12px;
}
.summaryline {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  font-size: 13px;
}
.ordercard {
  border-top: 1px solid var(--line);
  padding: 9px 0;
}
.ordercard p {
  margin: 5px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 35px;
}
#message:not(:empty) {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(1072px, calc(100% - 24px));
  max-height: 40vh;
  overflow: auto;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: #dcefd4;
  color: #244a2b;
  padding: 12px 20px;
  border-radius: 10px;
  margin-top: 0;
  box-shadow: 0 4px 16px #0004;
  font-size: 20px;
  line-height: 1.45;
  font-weight: 700;
}
#cart {
  font-size: 13px;
}
#admin {
  margin-top: 20px;
}
#admin form {
  max-width: 600px;
}
[hidden] {
  display: none !important;
}
:focus-visible {
  outline: 3px solid #bd924c;
  outline-offset: 3px;
}
@media (max-width: 720px) {
  header {
    height: 74px;
    padding: 0 20px;
  }
  main {
    padding: 16px;
  }
  .hero {
    padding: 26px 0;
  }
  .heroicon {
    width: 110px;
    height: 110px;
    font-size: 75px;
  }
  h1 {
    font-size: 30px;
  }
  .hero .muted {
    font-size: 12px;
  }
  .layout {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .session {
    padding: 18px;
  }
  .session h2 {
    font-size: 21px;
  }
  nav {
    gap: 17px;
    font-size: 13px;
  }
  .panel {
    padding: 19px;
  }
  .meal {
    gap: 6px;
  }
  .mealinfo b {
    font-size: 15px;
  }
  .sectiontitle span {
    font-size: 11px;
  }
}
.orderheading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.payment {
  font-size: 13px;
  border-radius: 20px;
  padding: 5px 12px;
  white-space: nowrap;
}
.payment.paid {
  background: #e5f3e8;
  color: #235638;
  border: 1px solid #b9dbbf;
}
.payment.unpaid {
  background: #fff3df;
  color: #825817;
  border: 1px solid #ebd3ad;
}
.collection-summary {
  background: #edf3e7;
  padding: 12px;
  border-radius: 8px;
  font-weight: 600;
}
.collection-total {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  padding-bottom: 12px;
  color: #174c30;
  border-bottom: 2px solid #bdd4b7;
  font-size: 20px;
}
.collection-total strong {
  font-size: 34px;
}
.collection-received {
  margin: 12px 0;
  font-size: 18px;
}
.collection-received small {
  font-size: 12px;
  font-weight: 400;
}
.collection-people {
  margin: 8px 0;
  line-height: 1.8;
  overflow-wrap: anywhere;
}
.collection-owing {
  color: #963e1d;
}
.store-notes {
  font-size: 13px;
  white-space: pre-wrap;
  color: #626f60;
  overflow-wrap: anywhere;
}
.store-notes:empty {
  display: none;
}

.session-announcement {
  margin: 12px 0;
  padding: 18px 20px;
  border: 2px solid #e59898;
  border-left: 6px solid #bd2020;
  border-radius: 12px;
  background: #fff0f0;
  color: #b51c1c;
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 800;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.layout.single-column {
  grid-template-columns: minmax(0, 1fr);
}
.orderheading {
  flex-wrap: wrap;
  gap: 4px 10px;
}
.orderdetails,
.orderfooter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin-top: 5px;
  overflow-wrap: anywhere;
}
.orderdetails {
  white-space: pre-wrap;
}
.orderfooter {
  font-size: 14px;
}
.orderactions {
  display: flex;
  gap: 5px;
  margin-left: auto;
}
.orderactions button {
  padding: 4px 9px;
  font-size: 12px;
  min-height: 30px;
  border-radius: 6px;
}
.ordercard .payment {
  padding: 4px 9px;
  font-size: 12px;
}
#manage > h2 {
  margin-bottom: 10px;
}

.announcement-settings {
  border: 1px solid #e3b2b2;
  border-radius: 10px;
  background: #fff7f7;
  padding: 12px;
  margin: 12px 0 20px;
}
.announcement-settings label {
  margin-top: 0;
}
#announcementEdit {
  min-height: 40px;
  height: 40px;
  padding: 8px 10px;
  resize: vertical;
}
#saveAnnouncement {
  padding: 6px 12px;
  font-size: 14px;
}

.combo-meal {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.combo-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: 6px 0;
}
.combo-options label {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  font-size: 14px;
}
.combo-options input {
  width: auto;
  margin: 0;
}
.combo-meal button,
.combo-builder button {
  padding: 6px 12px;
  font-size: 14px;
}
.combo-bag .summaryline {
  gap: 8px;
  align-items: center;
}
.combo-builder {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin: 12px 0;
}

.session-time-row {
  display: grid;
  grid-template-columns: 80px minmax(0, 210px);
  align-items: center;
  gap: 10px;
  margin: 8px 0;
}
.session-time-row input {
  min-width: 0;
  margin: 0;
  padding: 7px 10px;
}

.meal.selected-meal, .combo-meal.selected-meal, .custom-meal.selected-meal {
  background: #d5edce;
  box-shadow: inset 4px 0 0 #357442;
  border-radius: 8px;
  padding-left: 12px;
  padding-right: 10px;
}
.selected-meal .stepper output { color: #174c25; font-weight: 800; }

/* Primary pages: framed tabs directly below today's restaurant. */
.page-tabs {
  position:sticky;
  top:var(--message-height, 0px);
  z-index:10;
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:8px;
  margin:12px 0 16px;
  padding:8px;
  border:2px solid #b4c7b6;
  border-radius:14px;
  background:#eaf0e8;
  box-shadow:0 3px 9px #243b3012;
}
/* Keep the initial placeholder until the server has resolved the user's role. */
.page-tabs[aria-busy="true"] { visibility:hidden; }
.page-tabs.admin-tabs { grid-template-columns:repeat(5, minmax(0, 1fr)); }
.page-tabs button {
  min-width:0;
  padding:11px 12px;
  border:1px solid #aabdac;
  border-radius:9px;
  background:#fff;
  color:#344c3c;
  font-weight:700;
  white-space:normal;
  overflow-wrap:anywhere;
}
.page-tabs button.active {
  background:#285338;
  border-color:#285338;
  color:#fff;
  box-shadow:0 2px 5px #243b3033;
}
.page-tabs button:hover:not(.active) { background:#dcebd8; }
.page-tabs button:focus-visible { outline:3px solid #94762b; outline-offset:2px; }
@media(max-width:600px) {
 .page-tabs {gap:6px;padding:6px;}
 .page-tabs.admin-tabs {grid-template-columns:repeat(3, minmax(0, 1fr));}
 .page-tabs button {padding:10px 8px;font-size:14px;}
}

/* Lunch bag and submission reminder. */
#orderForm {
  border:2px solid #658c6b;
  border-top:6px solid #285338;
  background:#f5faf2;
  box-shadow:0 5px 16px #243b301a;
}
#orderForm h2 {
  color:#254d32;
  padding-bottom:12px;
  border-bottom:2px solid #cadbc6;
}
#orderForm .submit-reminder {
  margin:14px 0 0;
  padding:12px 10px;
  border:2px solid #d5a247;
  border-radius:9px;
  background:#fff0ce;
  color:#713e00;
  font-size:16px;
  font-weight:800;
  line-height:1.5;
  text-align:center;
}

#orderForm #cart, #orderForm #cart .summaryline, #orderForm #cart .stepper {
  color: #000;
}

/* Compact quantity totals for the public orders and admin management pages. */
.meal-counts {
  margin: 0 0 16px;
  padding: 12px;
  border: 2px solid #b4c7b6;
  border-radius: 10px;
  background: #f0f6ed;
  color: #000;
}
.meal-counts-heading, .meal-count-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.meal-counts-heading { margin-bottom: 6px; }
.meal-counts-heading h3 { margin: 0; font-size: 16px; }
.meal-counts-heading strong { color: #285338; font-size: 20px; white-space: nowrap; }
.meal-counts-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); column-gap: 20px; }
.meal-count-row { padding: 4px 0; border-top: 1px solid #d5dfd0; }
.meal-count-row span { overflow-wrap: anywhere; }
.meal-count-row b { white-space: nowrap; }
.meal-counts-list p { margin: 0; }

#message > span { overflow-wrap: anywhere; }
#message > button { flex: 0 0 auto; padding: 0 8px; background: transparent; border: 1px solid currentColor; color: inherit; font-size: 22px; }
#message[data-type="error"] { background: #b42318; color: #fff; }
#comboFeedback:empty, #settlementError:empty { display: none; }
#comboFeedback:not(:empty), #settlementError:not(:empty) {
  padding: 10px 12px;
  border: 2px solid #ba712b;
  border-radius: 8px;
  background: #fff3d9;
  color: #713500;
  font-weight: 700;
  scroll-margin-block: 140px;
}

.cash-coins { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); justify-items: center; gap: 8px; margin: 12px 0; }
.cash-coins .coin {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 50%;
  border: 2px solid;
  padding: 0;
  font-size: 18px;
  font-weight: 800;
  box-shadow: inset 0 0 0 3px #ffffff80, 0 2px 3px #0002;
}
.coin-gold { background: linear-gradient(135deg, #fff2af, #d5a936); border-color: #a37a13; color: #584000; }
.coin-silver { background: linear-gradient(135deg, #fafafa, #b8c0c8); border-color: #7a858d; color: #303b44; }
.coin-copper { background: linear-gradient(135deg, #f3c5a3, #bd784b); border-color: #92552d; color: #542a12; }
.cash-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cash-actions button { padding: 10px 8px; border: 2px solid; border-radius: 9px; font-size: 16px; font-weight: 800; box-shadow: 0 2px 5px #0002; }
#cashExact { background: #285338; color: #fff; border-color: #173b24; }
#cashClear { background: #fff1e5; color: #9a3e13; border-color: #ba6b3b; }
.cash-actions button:active, .cash-coins button:active, .banknotes button:active { transform: translateY(1px); }

/* Keep touch-device form fields readable without focus-triggered browser zoom.
   The viewport remains unrestricted so users can still pinch to zoom. */
@media (max-width: 720px), (any-pointer: coarse) {
  input, textarea, select {
    font-size: 16px;
  }
}

/* Keep settlement actions visible while long orders scroll inside the dialog. */
#settlementDialog { padding: 12px; overflow: hidden; }
#settlementForm {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: calc(92vh - 24px);
  max-height: calc(92dvh - 24px);
  margin: 0;
}
#settlementForm .photo-toolbar { margin-bottom: 4px; }
#settlementForm .photo-toolbar h2 { margin: 0; font-size: 20px; }
.settlement-body { overflow: auto; min-height: 0; padding: 0 2px; }
#settlementForm p { margin: 6px 0; }
#settlementItems { color: #000; font-size: 13px; }
.settlement-price-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
#settlementForm label { margin: 6px 0; }
#settlementForm input { min-width: 0; margin-top: 3px; padding: 7px 9px; }
#settlementForm .settlement-due { margin: 6px 0; }
#settlementForm .cash-coins { margin: 8px 0; }
#settlementForm .cash-actions button { padding: 7px 8px; }
#settlementForm .change-result { margin: 8px 0; padding: 8px 12px; font-size: 23px; }
.settlement-footer { padding-top: 8px; margin-top: 4px; border-top: 1px solid #d4dfd0; background: #fff; }
#saveSettlement { width: 100%; margin: 0; padding: 10px; }
.order-people { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.order-people input { min-width: 0; font-size: 16px; }
.order-preferences { display: flex; flex-wrap: wrap; column-gap: 20px; row-gap: 10px; margin: 12px 0; }
.order-preferences .rice-option { display: inline-flex; gap: 5px; margin: 0; white-space: nowrap; }
.order-preferences input { flex-shrink: 0; }
.order-page-end { text-align: center; margin: 12px 0 24px; }
#orderForm #note { height: 42px; min-height: 42px; padding: 8px 10px; font-size: 16px; resize: vertical; }

/* Pending bag items: stronger contrast without changing submitted order cards. */
#orderForm #cart .summaryline {
  background: #d5ebc9;
  border: 1px solid #82a66c;
  border-left: 5px solid #477232;
  border-radius: 9px;
  padding: 10px;
  margin: 8px 0;
  gap: 10px;
  color: #000;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.5;
  align-items: center;
}
#orderForm #cart .summaryline > span:first-child { min-width: 0; overflow-wrap: anywhere; }
#orderForm #cart .summaryline > span:last-child { flex-shrink: 0; white-space: nowrap; }
#orderForm #cart .stepper output { font-size: 17px; font-weight: 800; }

.combo-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.combo-heading .mealinfo { min-width: 0; }
.combo-heading .stepper button { padding: 0; }
.stepper output.multiple-quantity, #orderForm #cart .stepper output.multiple-quantity {
  background: #ffe0a3; color: #8b3500; border: 2px solid #c66b12;
  border-radius: 6px; min-width: 32px; font-weight: 800; font-size: 18px;
}
.combo-quantity-warning, .quantity-reminder { color: #8b3500; background: #fff0cc; font-weight: 800; border-radius: 5px; padding: 3px 7px; }
.combo-quantity-warning { margin: 5px 0 0; font-size: 14px; }
.quantity-reminder { display: block; width: fit-content; margin-top: 3px; font-size: 14px; }
.cash-actions.cash-input-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: stretch;
  gap: 6px;
  margin-bottom: 10px;
}
#settlementForm .cash-input-row input { margin: 0; font-size: 16px; }
#settlementForm .cash-input-row button { padding: 7px 6px; white-space: nowrap; }
.meal-count-entry { min-width: 0; }
.meal-counts-list .meal-orderers { margin: 0 0 8px; font-size: 14px; line-height: 1.6; color: #243b30; overflow-wrap: anywhere; }
