:root {
  --bg: #f4f1ea;
  --paper: #fffcf7;
  --ink: #171412;
  --muted: #6b635c;
  --accent: #0c7c59;
  --accent-2: #f09d51;
  --danger: #a63d40;
  --line: #e7dbcf;
  --card-shadow: 0 18px 38px rgba(28, 26, 24, 0.08);
  --radius-lg: 18px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: 'Avenir Next', 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top right, #f6dcc1 0%, var(--bg) 45%, #ece7de 100%);
}

body {
  min-height: 100vh;
}

.app-shell {
  width: min(1100px, 94vw);
  margin: 26px auto 40px;
}

.hero {
  background: linear-gradient(130deg, #1f363d 0%, #185b63 48%, #158068 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--card-shadow);
}

.hero h1 {
  margin: 0;
  font-size: 1.45rem;
  letter-spacing: 0.02em;
}

.hero p {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.88);
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 18px;
}

@media (min-width: 768px) {
  .grid.cols-2 {
    grid-template-columns: 1.25fr 0.75fr;
  }

  .grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--card-shadow);
}

.card h2,
.card h3 {
  margin: 0;
}

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

.menu-list {
  display: grid;
  gap: 12px;
}

.menu-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px;
  background: #fff;
}

.menu-title-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.price {
  font-weight: 700;
  color: #0e6d5f;
}

.qty-controls {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: none;
  background: var(--ink);
  color: #fff;
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
}

button:hover {
  opacity: 0.92;
}

button.secondary {
  background: #3f5f56;
}

button.light {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

button.warn {
  background: var(--danger);
}

a.button-link {
  display: inline-block;
  text-decoration: none;
  border-radius: 10px;
  padding: 9px 12px;
  color: #fff;
  background: #3f5f56;
}

a.button-link.light {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #d5c8ba;
  border-radius: 10px;
  padding: 9px 10px;
  background: #fff;
}

textarea {
  min-height: 86px;
}

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

.row.wrap {
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.86rem;
  background: #e8f4f1;
  color: #19594a;
}

.order-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px;
  background: #fff;
}

.order-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.status-new {
  background: #ffefc8;
  color: #835600;
}

.status-preparing {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-ready {
  background: #dcfce7;
  color: #166534;
}

.status-served {
  background: #f1f5f9;
  color: #334155;
}

.status-cancelled {
  background: #fee2e2;
  color: #b91c1c;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 6px;
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-weight: 600;
}

.notice {
  border-left: 4px solid var(--accent-2);
  padding: 10px 12px;
  background: #fff6eb;
  border-radius: 10px;
}

.qr-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px;
  background: #fff;
}

.qr-card img {
  width: 220px;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 6px;
}

hr.soft {
  border: 0;
  border-top: 1px dashed #d7cabd;
  margin: 14px 0;
}

.text-right {
  text-align: right;
}

.small {
  font-size: 0.92rem;
}

.zone-title.completed {
  color: #8f8a84;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.zone-meta {
  color: var(--muted);
  font-size: 0.88rem;
}

.zone-done-note {
  color: #8f8a84;
  font-size: 0.88rem;
}

/* Front admin split layout */
.admin-board {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.admin-orders-grid {
  grid-template-columns: 1fr;
}

.zone-card-clickable {
  cursor: pointer;
}

.zone-card-clickable:hover {
  border-color: #c6b6a5;
}

.admin-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 13, 11, 0.3);
  z-index: 70;
}

.admin-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(560px, 94vw);
  height: 100vh;
  background: var(--paper);
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 40px rgba(20, 18, 16, 0.14);
  z-index: 80;
  transform: translateX(102%);
  transition: transform 0.26s ease;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.admin-drawer.open {
  transform: translateX(0);
}

.admin-drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line);
}

.admin-drawer-head h3 {
  margin: 0;
}

.admin-drawer-body {
  overflow: auto;
  padding: 12px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.admin-drawer-footer {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
  background: #fff;
}

@media (min-width: 768px) {
  .admin-board {
    grid-template-columns: minmax(300px, 40%) minmax(0, 60%);
    align-items: start;
  }

  .admin-board > .card {
    min-height: calc(100vh - 200px);
    max-height: calc(100vh - 200px);
    overflow: auto;
  }
}

@media (min-width: 1100px) {
  .admin-orders-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Front user mobile-first layout */
.user-page .user-shell {
  width: min(980px, 94vw);
  margin: 16px auto 120px;
}

.user-page .user-hero {
  border-radius: 20px;
  padding: 18px;
}

.user-page .access-gate {
  margin-top: 12px;
  border-color: #f0d8b6;
  background: #fff7eb;
}

.user-page .access-gate h2 {
  margin: 0;
  font-size: 1.05rem;
}

.user-page .category-tabs-wrap {
  margin-top: 0;
  padding: 10px;
  background: rgba(255, 252, 247, 0.94);
  backdrop-filter: blur(4px);
}

.user-page .sticky-menu-head {
  margin-top: 14px;
  position: sticky;
  top: 8px;
  z-index: 14;
}

.user-page .welcome-banner {
  margin-bottom: 8px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid rgba(124, 163, 255, 0.34);
  background: rgba(10, 18, 38, 0.82);
  color: #9fc2ff;
  font-family: "Brush Script MT", "Segoe Script", "Snell Roundhand", cursive;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  text-align: center;
}

.user-page .category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

.user-page .category-tabs::-webkit-scrollbar {
  display: none;
}

.user-page .cat-tab {
  border: 1px solid var(--line);
  background: #fff;
  color: #22322f;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.9rem;
  flex: 0 0 auto;
}

.user-page .cat-tab.active {
  background: #1f5f57;
  color: #fff;
  border-color: #1f5f57;
}

.user-page .menu-sections {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.user-page .category-section {
  scroll-margin-top: 150px;
  padding: 14px;
}

.user-page .category-section h2 {
  margin: 0 0 10px;
  font-size: 1.1rem;
}

.user-page .user-menu-item {
  padding: 10px;
}

.user-page .cart-fab {
  position: fixed;
  right: 14px;
  bottom: 18px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  background: #113f3a;
  color: #fff;
  padding: 10px 14px;
  box-shadow: 0 14px 30px rgba(16, 42, 40, 0.35);
}

.user-page .cart-fab-label {
  font-weight: 700;
}

.user-page .cart-fab-count {
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f59f57;
  color: #1f1a16;
  font-size: 0.82rem;
  font-weight: 700;
}

.user-page .cart-fab-total {
  opacity: 0.92;
  font-weight: 700;
}

.user-page .cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 16, 16, 0.34);
  z-index: 31;
}

.user-page .cart-drawer {
  position: fixed;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
  max-height: 82vh;
  background: #fffaf4;
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  border: 1px solid #dccfbe;
  padding: 14px;
  z-index: 32;
  transform: translateY(104%);
  transition: transform 0.25s ease;
  overflow-y: auto;
}

.user-page .cart-drawer.open {
  transform: translateY(0);
}

.user-page .cart-drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.user-page .cart-drawer-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.user-page .cart-drawer-footer {
  margin-top: 10px;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
}

.user-page .drawer-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.user-page .orders-panel {
  margin-top: 12px;
  border-top: 1px dashed #d7cabd;
  padding-top: 10px;
}

.user-page .orders-panel h3 {
  margin: 0 0 8px;
  font-size: 0.98rem;
}

.user-page .room-live-panel {
  margin-top: 10px;
}

.user-page .room-live-person {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 9px;
  background: #fff;
  margin-bottom: 8px;
}

.user-page .room-live-person .head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.user-page .order-history-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 9px;
  background: #fff;
  margin-bottom: 8px;
}

.user-page .order-history-item .head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.user-page .checkout-breakdown {
  display: grid;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.user-page .checkout-breakdown-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.88rem;
  color: #4f4a43;
}

.user-page .checkout-breakdown-row.total {
  margin-top: 3px;
  padding-top: 5px;
  border-top: 1px dashed #d7cabd;
  font-size: 0.95rem;
  color: #1c1a19;
}

.user-page .cart-item-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 9px;
  background: #fff;
  margin-bottom: 8px;
}

.user-page .cart-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.user-page .cart-item-breakdown {
  margin-top: 6px;
  display: grid;
  gap: 2px;
}

.user-page .cart-item-breakdown > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.83rem;
  color: #5d574f;
}

.user-page .cart-item-breakdown .line-total {
  margin-top: 2px;
  padding-top: 3px;
  border-top: 1px dashed #e1d6ca;
  color: #1f1b18;
}

.user-page .cart-item-breakdown strong,
.user-page .checkout-breakdown strong {
  font-weight: 700;
}

@media (min-width: 860px) {
  .user-page .user-shell {
    margin-bottom: 70px;
  }

  .user-page .menu-sections {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .user-page .category-section {
    scroll-margin-top: 164px;
  }

  .user-page .cart-drawer {
    border-radius: 18px;
    right: 18px;
    bottom: 18px;
    max-height: 76vh;
    transform: translateY(110%);
  }

  .user-page .cart-drawer.open {
    transform: translateY(0);
  }
}

/* KTV-brand theme override for front_user */
.user-page {
  color: #dce7ff;
  background:
    radial-gradient(1200px 700px at 15% 20%, rgba(126, 35, 118, 0.36), transparent 62%),
    radial-gradient(900px 600px at 82% 28%, rgba(0, 186, 199, 0.24), transparent 58%),
    linear-gradient(135deg, #070918 0%, #0a0f2a 45%, #06142a 100%);
}

html.user-page-root,
body.user-page {
  overscroll-behavior-x: none;
}

.user-page main,
.user-page .app-shell {
  touch-action: pan-y;
}

.user-page button,
.user-page .cat-tab,
.user-page .cart-fab,
.user-page .menu-item-qty button {
  touch-action: manipulation;
}

.user-page .user-hero {
  background: linear-gradient(120deg, rgba(11, 20, 43, 0.92), rgba(10, 74, 106, 0.78));
  border: 1px solid rgba(117, 158, 255, 0.28);
  box-shadow: 0 16px 42px rgba(3, 8, 24, 0.55);
}

.user-page .user-hero p {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: 0.02em;
  font-weight: 700;
  color: #8eb8ff;
}

.user-page .card,
.user-page .menu-item,
.user-page .category-tabs-wrap,
.user-page .category-section,
.user-page .cart-item-row {
  background: rgba(12, 19, 42, 0.7);
  border-color: rgba(124, 163, 255, 0.24);
  color: #dce7ff;
  box-shadow: 0 14px 34px rgba(2, 8, 24, 0.45);
}

.user-page .muted {
  color: #93a8d8;
}

.user-page .category-tabs-wrap {
  background: rgba(10, 18, 38, 0.82);
  backdrop-filter: blur(10px);
}

.user-page .cat-tab {
  background: rgba(9, 21, 49, 0.7);
  border-color: rgba(124, 163, 255, 0.34);
  color: #d3e1ff;
}

.user-page .cat-tab.active {
  background: linear-gradient(135deg, #4a7fff, #63a2ff);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 24px rgba(74, 127, 255, 0.45);
}

.user-page .price {
  color: #80b3ff;
}

.user-page input,
.user-page textarea,
.user-page select {
  background: rgba(9, 16, 36, 0.72);
  border-color: rgba(122, 162, 255, 0.34);
  color: #deebff;
}

.user-page input::placeholder,
.user-page textarea::placeholder {
  color: #88a1d6;
}

.user-page button {
  background: linear-gradient(135deg, #4a7fff, #63a2ff);
  color: #fff;
}

.user-page button.light {
  background: rgba(11, 21, 46, 0.72);
  border-color: rgba(124, 163, 255, 0.34);
  color: #dbe7ff;
}

.user-page button.secondary {
  background: linear-gradient(135deg, #2f6bd8, #4d8bff);
}

.user-page .cart-fab {
  background: linear-gradient(135deg, #4a7fff, #63a2ff);
  box-shadow: 0 16px 32px rgba(73, 126, 255, 0.4);
}

.user-page .cart-fab-count {
  background: #ffe08a;
  color: #121622;
}

.user-page .cart-drawer {
  background: rgba(8, 14, 31, 0.95);
  border-color: rgba(124, 163, 255, 0.3);
  color: #dce7ff;
}

.user-page .checkout-breakdown-row,
.user-page .cart-item-breakdown > div {
  color: #c2d5ff;
}

.user-page .checkout-breakdown-row.total,
.user-page .cart-item-breakdown .line-total {
  color: #f0f5ff;
}

/* Ensure front_user dark theme fully covers mobile viewport/overscroll area */
html.user-page-root {
  background:
    radial-gradient(1200px 700px at 15% 20%, rgba(126, 35, 118, 0.36), transparent 62%),
    radial-gradient(900px 600px at 82% 28%, rgba(0, 186, 199, 0.24), transparent 58%),
    linear-gradient(135deg, #070918 0%, #0a0f2a 45%, #06142a 100%);
}

body.user-page {
  min-height: 100dvh;
  background: transparent;
}

body.user-page::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1200px 700px at 15% 20%, rgba(126, 35, 118, 0.36), transparent 62%),
    radial-gradient(900px 600px at 82% 28%, rgba(0, 186, 199, 0.24), transparent 58%),
    linear-gradient(135deg, #070918 0%, #0a0f2a 45%, #06142a 100%);
}

body.user-page.access-locked .user-hero,
body.user-page.access-locked .sticky-menu-head,
body.user-page.access-locked .menu-sections,
body.user-page.access-locked .cart-fab {
  display: none !important;
}

body.user-page.access-locked .access-gate {
  margin-top: 0;
}
