:root {
  --bg: #e8e6e1;
  --card: #ffffff;
  --card-2: #fbfaf8;
  --border: #eae7e1;
  --border-strong: #e2dfd9;
  --text: #1c1b19;
  --text-soft: #4a4741;
  --text-mid: #8b8781;
  --text-dim: #9a968f;
  --text-faint: #b0aca4;
  --ink: #26251f;
  --success-bg: #e9f0ea;
  --success-fg: #4a7a4f;
  --success-dot: #7fae7f;
  --warn-bg: #f4efe3;
  --warn-fg: #8a6d2f;
  --info-bg: #e9eef2;
  --info-fg: #3f6079;
  --danger-bg: #f3eded;
  --danger-fg: #9a5b5b;
  --off-dot: #d5d2cc;
  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-pop: 0 30px 60px -20px rgba(0, 0, 0, 0.35);
  --serif: 'Cormorant Garamond', serif;
  --sans: 'Instrument Sans', 'IBM Plex Sans Thai', system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: #e8e6e1;
  background-image: radial-gradient(circle at 30% 20%, #edebe6, #e2e0da);
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text-soft); text-decoration: none; }

.thin { scrollbar-width: thin; scrollbar-color: #d5d2cc transparent; }
.thin::-webkit-scrollbar { width: 7px; height: 7px; }
.thin::-webkit-scrollbar-thumb { background: #d5d2cc; border-radius: 8px; }
.thin::-webkit-scrollbar-track { background: transparent; }

@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.8); } }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fade .3s; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 26px 30px 60px; }
.wrap-narrow { max-width: 460px; margin: 0 auto; padding: 0 0 90px; }

h1 { font-family: var(--serif); font-size: 26px; font-weight: 600; margin: 0 0 4px; letter-spacing: .2px; }
h2 { font-family: var(--serif); font-size: 21px; font-weight: 600; margin: 0 0 10px; color: var(--text); }
h3 { font-size: 12px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; margin: 0 0 9px; color: var(--text-dim); }

label { display: block; font-size: 12px; color: var(--text-mid); margin-bottom: 5px; font-weight: 500; }
input, select, textarea {
  width: 100%; padding: 10px 13px; margin-bottom: 12px;
  background: var(--card-2); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); color: var(--text); font-size: 14px; font-family: inherit;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--ink); }
input[type=checkbox] { width: auto; margin-right: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 18px; border-radius: var(--radius-sm);
  background: var(--ink); color: #fff; font-weight: 600; font-family: inherit;
  border: none; cursor: pointer; font-size: 14px; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .35);
}
.btn:hover { background: #38352c; }
.btn-outline {
  background: #fff; border: 1px solid var(--border-strong); color: var(--text-soft); box-shadow: none;
}
.btn-outline:hover { border-color: var(--ink); color: var(--ink); }
.btn-danger { background: #fff; border: 1px solid #eee3e3; color: var(--danger-fg); box-shadow: none; }
.btn-danger:hover { background: var(--danger-bg); }
.btn-sm { padding: 7px 13px; font-size: 12px; border-radius: 9px; }
.btn:disabled { cursor: default; background: var(--border-strong); color: var(--text-faint); box-shadow: none; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--border); }
th { color: var(--text-dim); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }

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

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600;
}
.badge-pending { background: var(--warn-bg); color: var(--warn-fg); }
.badge-preparing { background: var(--info-bg); color: var(--info-fg); }
.badge-served { background: var(--success-bg); color: var(--success-fg); }
.badge-cancelled { background: var(--danger-bg); color: var(--danger-fg); }
.badge-unpaid { background: var(--warn-bg); color: var(--warn-fg); }
.badge-submitted { background: var(--info-bg); color: var(--info-fg); }
.badge-confirmed { background: var(--success-bg); color: var(--success-fg); }
.badge-soldout { background: var(--danger-bg); color: var(--danger-fg); }
.badge-gift { background: #f7f1e3; color: #8a6d2f; }

.muted { color: var(--text-mid); font-size: 13px; }
.total { font-family: var(--serif); font-size: 24px; font-weight: 600; color: var(--ink); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot-live { background: var(--success-dot); animation: pulse 2s infinite; }
.dot-off { background: var(--off-dot); }

.flash { padding: 11px 15px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 14px; }
.flash-error { background: var(--danger-bg); color: var(--danger-fg); }
.flash-ok { background: var(--success-bg); color: var(--success-fg); }

/* ---------- Public landing hero ---------- */
.landing-hero {
  min-height: 60vh; display: flex; flex-direction: column; justify-content: center;
  align-items: center; text-align: center; padding: 60px 20px;
  background-size: cover; background-position: center; position: relative;
}
.landing-hero::before { content: ""; position: absolute; inset: 0; background: rgba(28, 27, 25, .55); }
.landing-hero > * { position: relative; z-index: 1; color: #fff; }
.landing-hero h1 { font-size: 40px; color: #fff; }
.landing-hero p { max-width: 520px; color: #ece9e3; }

/* ---------- Admin shell: sidebar + content ---------- */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 220px; flex: none; background: #fbfaf8; border-right: 1px solid var(--border);
  padding: 22px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand-mark {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: linear-gradient(145deg, #fff, #dcdce0);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 700; font-size: 17px; color: var(--ink);
}
.brand-row { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; }
.brand-row .name { font-family: var(--serif); font-size: 16px; font-weight: 600; line-height: 1.15; }
.brand-row .name small { display: block; font-size: 11px; color: var(--text-dim); font-family: var(--sans); font-weight: 400; }

.nav-link {
  display: flex; align-items: center; justify-content: space-between; width: 100%; text-align: left;
  padding: 11px 12px; margin-bottom: 3px; border-radius: 10px; font-size: 14px; font-weight: 500;
  font-family: inherit; cursor: pointer; border: none; background: transparent; color: #57534d;
  text-decoration: none;
}
.nav-link.active { background: var(--ink); color: #fff; font-weight: 600; }
.nav-link .nav-badge { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--warn-bg); color: var(--warn-fg); }
.nav-link.active .nav-badge { background: rgba(255, 255, 255, .2); color: #fff; }

.sidebar-foot { margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid var(--border); }
.admin-content { flex: 1; min-width: 0; overflow-y: auto; }
.admin-content-pad { padding: 26px 30px; }

/* session banner */
.session-banner {
  display: flex; align-items: center; gap: 14px; border-radius: var(--radius); padding: 14px 18px; margin-bottom: 20px;
  border: 1px solid var(--border-strong); background: #fff;
}
.session-banner.open { background: var(--success-bg); border-color: #dbe8db; }
.session-banner.closed { background: var(--danger-bg); border-color: #eddede; }

/* live pill */
.live-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px; background: #fff; border: 1px solid var(--border); font-size: 12px; font-weight: 500; color: var(--text-soft); }

/* queue row */
.queue-row { display: flex; align-items: center; gap: 16px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 18px; box-shadow: var(--shadow-card); margin-bottom: 11px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: #f1efeb; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; color: var(--text-soft); flex: none; }
.avatar-sm { width: 32px; height: 32px; font-size: 13px; }

/* guest tab card */
.guest-tab-card {
  text-align: left; background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px; cursor: pointer; box-shadow: var(--shadow-card); width: 100%; font-family: inherit;
}
.guest-tab-card:hover { border-color: var(--border-strong); }

/* pill chip (for split/gift/guest-select) */
.chip {
  font-size: 12px; font-weight: 500; font-family: inherit; padding: 7px 13px; border-radius: 999px;
  cursor: pointer; border: 1px solid var(--border-strong); background: var(--card-2); color: var(--text-soft);
}
.chip.on { border-color: var(--ink); background: var(--ink); color: #fff; }
.chip-btn { border: none; }

/* ---------- Overlay / modal ---------- */
.overlay-backdrop {
  position: fixed; inset: 0; background: rgba(28, 27, 25, .4); backdrop-filter: blur(3px);
  z-index: 50; display: flex; align-items: center; justify-content: center; padding: 30px;
}
.overlay-panel {
  width: 560px; max-width: 100%; max-height: 88vh; overflow-y: auto; background: #faf9f7;
  border-radius: var(--radius-lg); box-shadow: 0 40px 80px -20px rgba(0, 0, 0, .5); animation: fade .2s;
}
.overlay-panel.narrow { width: 340px; text-align: center; padding: 28px; }
.overlay-head {
  position: sticky; top: 0; background: #faf9f7; padding: 22px 26px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 13px; z-index: 2;
}
.overlay-body { padding: 20px 26px; }
.overlay-close {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border-strong); background: #fff;
  font-size: 15px; color: var(--text-mid); cursor: pointer;
}
.section-label { font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--text-dim); margin-bottom: 10px; }

.bill-line { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid #f1eee9; }
.bill-line:last-child { border-bottom: none; }

.bill-line-details { border-bottom: 1px solid #f1eee9; }
.bill-line-details:last-child { border-bottom: none; }
.bill-line-details summary { list-style: none; cursor: pointer; border-bottom: none; }
.bill-line-details summary::-webkit-details-marker { display: none; }
.bill-line-details .split-editor { padding: 4px 0 16px; }

/* ---------- Guest phone shell ---------- */
.phone-header {
  position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px 10px; background: #f6f5f3; border-bottom: 1px solid var(--border);
}
.phone-brand { font-family: var(--serif); font-size: 16px; font-weight: 600; }
.phone-body { padding: 6px 20px 30px; }

.hero-photo {
  margin: 8px 0 0; height: 200px; border-radius: var(--radius); background: repeating-linear-gradient(135deg, #e7e4de, #e7e4de 11px, #efece7 11px, #efece7 22px);
  position: relative; display: flex; align-items: flex-end; overflow: hidden; box-shadow: inset 0 0 0 1px #e0ddd6;
}
.hero-photo .scrim { width: 100%; padding: 18px 20px; background: linear-gradient(transparent, rgba(30, 29, 27, .72)); }
.hero-photo .scrim .name { font-family: var(--serif); font-size: 26px; font-weight: 600; color: #fff; }

.item-card {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .03); font-family: inherit;
}
.item-card:disabled, .item-card.disabled { opacity: .55; cursor: default; }
.item-thumb { width: 54px; height: 54px; border-radius: 11px; flex: none; background: #efece7; background-size: cover; background-position: center; }

.opt-row {
  display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 13px 15px;
  border-radius: 12px; cursor: pointer; font-family: inherit; background: #fff; border: 1.5px solid var(--border);
  margin-bottom: 8px;
}
.opt-row.sel { background: #f3f1ec; border-color: var(--ink); }
.radio-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-strong); background: #fff; display: inline-block; }
.radio-dot.sel { border-color: var(--ink); background: radial-gradient(circle, #26251f 0 42%, #fff 44%); }

.qty-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border-strong); background: #fff; font-size: 18px; color: var(--text-soft); cursor: pointer; }

.bottom-nav {
  position: sticky; bottom: 0; display: flex; background: rgba(246, 245, 243, .94); backdrop-filter: blur(8px);
  border-top: 1px solid var(--border); padding: 8px 0 18px; max-width: 460px; margin: 0 auto;
}
.bottom-nav .nav-item {
  flex: 1; background: none; border: none; cursor: pointer; padding: 6px 0; display: flex;
  flex-direction: column; align-items: center; gap: 4px; text-decoration: none; font-size: 11px; font-weight: 500;
  color: var(--text-faint);
}
.bottom-nav .nav-item.active { color: var(--ink); }
.bottom-nav .nav-item .navdot { width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.bottom-nav .nav-item.active .navdot { background: var(--ink); }

.status-pill { display: flex; align-items: center; gap: 9px; padding: 13px 15px; border-radius: 14px; margin-bottom: 20px; }
.status-pill.open { background: var(--success-bg); }
.status-pill.closed { background: var(--danger-bg); }

.guest-item.soldout, .item-card.soldout { opacity: 0.55; }
.tab-col { min-width: 260px; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; background: var(--card-2); }
.queue-item { border-left: 3px solid var(--ink); padding: 8px 10px; margin-bottom: 8px; background: var(--card-2); border-radius: 8px; font-size: 13px; }
