:root {
  --green: #1a7a3d;
  --green-dark: #115a2b;
  --green-light: #e6f4ea;
  --amber: #ffb020;
  --ink: #16232e;
  --muted: #5d7183;
  --line: #dde5ec;
  --bg: #f2f6f9;
  --card: #ffffff;
  --danger: #c0392b;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(22, 35, 46, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- header ---------- */
.topbar {
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  color: #fff;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 2px 12px rgba(0,0,0,.18);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; letter-spacing: .3px; }
.brand .logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: #fff; color: var(--green);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800;
}
.brand small { display: block; font-size: 11px; font-weight: 400; opacity: .85; letter-spacing: .5px; }
.topbar .spacer { flex: 1; }
.userbox { text-align: right; font-size: 13px; line-height: 1.3; }
.userbox .balance { font-weight: 700; font-size: 15px; color: var(--amber); }
.btn-ghost {
  background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.35);
  border-radius: 9px; padding: 7px 13px; font-size: 13px; cursor: pointer;
}
.btn-ghost:hover { background: rgba(255,255,255,.25); }

/* ---------- tabs ---------- */
.tabs {
  display: flex; gap: 4px; padding: 10px 14px 0;
  max-width: 1080px; margin: 0 auto; overflow-x: auto;
}
.tab {
  border: 0; background: transparent; color: var(--muted);
  padding: 10px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
  border-radius: 10px 10px 0 0; white-space: nowrap;
}
.tab.active { background: var(--card); color: var(--green-dark); box-shadow: var(--shadow); }

main { max-width: 1080px; margin: 0 auto; padding: 14px; }

.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px;
}
h2 { margin: 0 0 6px; font-size: 20px; }
h3 { margin: 18px 0 8px; font-size: 15px; color: var(--green-dark); }
.muted { color: var(--muted); font-size: 13px; }

/* ---------- login ---------- */
.login-wrap {
  min-height: calc(100vh - 62px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background:
    radial-gradient(1000px 400px at 80% -10%, var(--green-light), transparent),
    var(--bg);
}
.login-card { max-width: 400px; width: 100%; }
.login-card .logo-big {
  width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 14px;
  background: var(--green); color: #fff; font-size: 34px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.login-card h1 { text-align: center; font-size: 22px; margin: 0 0 4px; }
.login-card .muted { text-align: center; display: block; margin-bottom: 18px; }

label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 5px; }
input[type=text], input[type=password], input[type=number], input[type=date], select {
  width: 100%; padding: 12px 13px; font-size: 16px;
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
  outline: none; transition: border-color .15s;
}
input:focus, select:focus { border-color: var(--green); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--green); color: #fff; border: 0; border-radius: 11px;
  padding: 13px 22px; font-size: 15px; font-weight: 700; cursor: pointer;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--green-dark); }
.btn:active { transform: scale(.98); }
.btn:disabled { background: #b9c6cf; cursor: not-allowed; }
.btn.block { width: 100%; margin-top: 18px; }
.btn.secondary { background: #eef3f7; color: var(--ink); }
.btn.secondary:hover { background: #e0e9f0; }
.btn.danger { background: var(--danger); }
.btn.small { padding: 8px 14px; font-size: 13px; border-radius: 9px; }

.error-box {
  background: #fdecea; color: var(--danger); border: 1px solid #f5c6c1;
  border-radius: 10px; padding: 10px 14px; font-size: 14px; margin-top: 12px; display: none;
}
.error-box.show { display: block; }
.notice {
  background: var(--green-light); border: 1px solid #bfe3cc; color: var(--green-dark);
  border-radius: 10px; padding: 10px 14px; font-size: 13px; margin: 10px 0;
}
.warn {
  background: #fff6e5; border: 1px solid #ffe0a3; color: #7a5200;
  border-radius: 10px; padding: 10px 14px; font-size: 13px; margin: 10px 0;
}

/* ---------- terms ---------- */
.terms-text {
  background: #f7fafc; border: 1px solid var(--line); border-radius: 10px;
  padding: 16px; font-size: 14px; line-height: 1.65; max-height: 45vh; overflow-y: auto;
}
.check-row { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; font-size: 14px; }
.check-row input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--green); }

/* ---------- plan menu ---------- */
.day-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; }
.day-chip {
  border: 1.5px solid var(--line); background: #fff; border-radius: 12px;
  padding: 10px 14px; min-width: 108px; cursor: pointer; text-align: center; flex-shrink: 0;
}
.day-chip .d1 { font-weight: 700; font-size: 14px; }
.day-chip .d2 { font-size: 11px; color: var(--muted); margin-top: 2px; }
.day-chip.active { border-color: var(--green); background: var(--green-light); }
.day-chip.closed { opacity: .55; }
.day-chip .dot { display: inline-block; width: 8px; height: 8px; border-radius: 99px; background: var(--green); margin-right: 4px; }
.day-chip .dot.gray { background: #b9c6cf; }

.menu-group { margin-bottom: 14px; }
.menu-group > h3, .cat-head {
  background: var(--green-light);
  color: var(--green-dark);
  border-left: 4px solid var(--green);
  border-radius: 8px;
  padding: 9px 13px;
  margin: 16px 0 4px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.menu-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 4px; border-bottom: 1px solid var(--line);
}
.menu-item:last-child { border-bottom: 0; }
.menu-item .nm { flex: 1; font-size: 15px; }
.menu-item .pr { text-align: right; font-size: 14px; white-space: nowrap; }
.menu-item .pr .old { color: var(--muted); text-decoration: line-through; font-size: 12px; margin-right: 6px; }
.menu-item .pr .new { font-weight: 700; color: var(--green-dark); }
.qty-ctrl { display: flex; align-items: center; gap: 6px; }
.qty-ctrl button {
  width: 34px; height: 34px; border-radius: 9px; border: 1.5px solid var(--line);
  background: #fff; font-size: 18px; font-weight: 700; cursor: pointer; color: var(--green-dark);
}
.qty-ctrl button:hover { border-color: var(--green); }
.qty-ctrl .q { min-width: 22px; text-align: center; font-weight: 700; font-size: 15px; }

/* ---------- cart summary bar ---------- */
.cartbar {
  position: sticky; bottom: 12px; z-index: 30;
  background: var(--ink); color: #fff; border-radius: 14px;
  padding: 13px 18px; display: none; align-items: center; gap: 14px;
  box-shadow: 0 10px 34px rgba(0,0,0,.3);
}
.cartbar.show { display: flex; }
.cartbar .sum { flex: 1; font-size: 14px; }
.cartbar .sum b { font-size: 17px; }
.cartbar .btn { background: var(--amber); color: #442e00; padding: 11px 20px; }
.cartbar .btn:hover { background: #ffc14d; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 8px 6px; border-bottom: 2px solid var(--line); }
td { padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.right { text-align: right; }

.status {
  display: inline-block; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 3px 10px;
}
.status.paid { background: var(--green-light); color: var(--green-dark); }
.status.pending_payment { background: #fff6e5; color: #7a5200; }
.status.cancelled { background: #fdecea; color: var(--danger); }
.status.settled { background: #e8eaf6; color: #283593; }

/* ---------- done / failed ---------- */
.center-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: var(--bg);
}
.result-card { max-width: 440px; width: 100%; text-align: center; }
.result-icon {
  width: 76px; height: 76px; border-radius: 99px; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center; font-size: 38px;
}
.result-icon.ok { background: var(--green-light); color: var(--green); }
.result-icon.bad { background: #fdecea; color: var(--danger); }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .topbar { padding: 10px 12px; }
  .brand { font-size: 16px; }
  .brand small { display: none; }
  main { padding: 10px; }
  .card { padding: 15px; border-radius: 12px; }
  .menu-item { flex-wrap: wrap; }
  .menu-item .nm { flex-basis: 100%; }
  .menu-item .pr { order: 2; flex: 1; text-align: left; }
  .qty-ctrl { order: 3; }
  .userbox .name { display: none; }
  .hide-mobile { display: none; }
}
.hidden { display: none !important; }
.spin {
  width: 26px; height: 26px; border-radius: 99px; margin: 30px auto;
  border: 3px solid var(--line); border-top-color: var(--green);
  animation: sp 0.8s linear infinite;
}
@keyframes sp { to { transform: rotate(360deg); } }
