:root {
  color-scheme: light;
  --bg: #f7f3ea;
  --surface: #fffaf0;
  --surface-strong: #ffffff;
  --ink: #25211b;
  --muted: #70685c;
  --line: #ded3c0;
  --accent: #1f7a55;
  --accent-dark: #12553a;
  --warm: #c75d2c;
  --danger: #b42318;
  --shadow: 0 18px 48px rgba(58, 42, 22, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family:
    ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  cursor: pointer;
  font-weight: 750;
  touch-action: manipulation;
}

button:active {
  transform: translateY(1px);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px max(18px, env(safe-area-inset-left)) 12px;
  padding-right: max(18px, env(safe-area-inset-right));
  border-bottom: 1px solid rgba(97, 78, 48, 0.16);
  background: rgba(247, 243, 234, 0.9);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

nav {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.78);
}

nav a {
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
  padding: 8px 12px;
  text-decoration: none;
}

nav a.active {
  background: var(--ink);
  color: white;
}

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px 18px 42px;
}

.order-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 20px;
  align-items: start;
}

.customer-panel,
.menu-panel,
.admin-layout,
.login-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.customer-panel {
  position: sticky;
  top: 86px;
  padding: 22px;
}

.menu-panel,
.admin-layout,
.login-panel {
  padding: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--warm);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 20px;
  font-size: clamp(30px, 6vw, 56px);
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 28px;
}

.section-heading {
  margin-bottom: 18px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
textarea {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  padding: 12px;
  outline: 0;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 122, 85, 0.14);
}

.summary-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.summary-box span {
  color: var(--muted);
  font-size: 14px;
}

.summary-box strong {
  color: var(--ink);
  font-size: 20px;
}

.primary-btn {
  width: 100%;
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.primary-btn:hover {
  background: var(--accent-dark);
}

.danger-btn {
  border-color: rgba(180, 35, 24, 0.28);
  color: var(--danger);
}

.hint {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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

.dish-card {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.dish-image {
  width: 84px;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  object-fit: cover;
}

.dish-card h3 {
  margin-bottom: 6px;
  font-size: 18px;
}

.dish-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.qty-control {
  display: grid;
  grid-template-columns: 42px 42px 42px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.qty-control button {
  min-height: 42px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 20px;
}

.qty-control span {
  text-align: center;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.admin-layout {
  min-height: 420px;
}

.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.admin-header button {
  padding: 0 16px;
}

.admin-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.admin-actions button {
  padding: 0 16px;
}

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

.order-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 16px;
}

.order-card header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.order-card h3 {
  margin: 0 0 4px;
}

.order-card time,
.order-card .note,
.empty-state {
  color: var(--muted);
}

.order-card ul {
  margin: 0;
  padding-left: 20px;
}

.order-count {
  color: var(--accent-dark);
  font-size: 20px;
  font-weight: 900;
  white-space: nowrap;
}

.empty-state {
  display: grid;
  min-height: 240px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.45);
  text-align: center;
}

.login-layout {
  display: grid;
  min-height: calc(100vh - 170px);
  place-items: center;
}

.login-panel {
  width: min(420px, 100%);
}

.login-panel h1 {
  font-size: clamp(32px, 7vw, 52px);
}

@media (max-width: 820px) {
  body {
    background: var(--surface);
  }

  .topbar {
    align-items: center;
    flex-direction: row;
    gap: 10px;
    padding: 10px max(12px, env(safe-area-inset-left)) 9px;
    padding-right: max(12px, env(safe-area-inset-right));
  }

  .brand {
    min-width: 0;
    gap: 8px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
  }

  .brand span:last-child {
    min-width: 0;
  }

  .brand strong {
    font-size: 15px;
  }

  .brand small {
    max-width: 120px;
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  nav {
    flex: 0 0 auto;
    gap: 3px;
    padding: 3px;
  }

  nav a {
    min-width: 58px;
    padding: 8px 10px;
    font-size: 13px;
    text-align: center;
  }

  .app-shell {
    padding: 12px 10px calc(28px + env(safe-area-inset-bottom));
  }

  .order-layout {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .customer-panel,
  .menu-panel,
  .admin-layout,
  .login-panel {
    border-radius: 8px;
    box-shadow: none;
  }

  .customer-panel {
    position: static;
    padding: 14px;
  }

  .menu-panel,
  .admin-layout,
  .login-panel {
    padding: 14px;
  }

  .eyebrow {
    font-size: 11px;
  }

  h1 {
    margin-bottom: 14px;
    font-size: 34px;
    line-height: 0.98;
  }

  h2 {
    font-size: 22px;
  }

  .section-heading {
    margin-bottom: 12px;
  }

  .field {
    gap: 6px;
    margin-bottom: 10px;
    font-size: 13px;
  }

  input,
  textarea {
    padding: 10px 11px;
    font-size: 16px;
  }

  textarea {
    max-height: 86px;
  }

  .summary-box {
    align-items: flex-start;
    margin: 12px 0;
    padding: 11px;
  }

  .summary-box span {
    font-size: 12px;
  }

  .summary-box strong {
    font-size: 18px;
  }

  .hint {
    margin-top: 10px;
    font-size: 12px;
  }

  .menu-list {
    gap: 8px;
  }

  .dish-card {
    grid-template-columns: 68px minmax(0, 1fr) 96px;
    gap: 9px;
    min-height: 96px;
    padding: 9px;
  }

  .dish-image {
    width: 68px;
    max-height: none;
    align-self: start;
    border-radius: 7px;
  }

  .dish-card h3 {
    display: -webkit-box;
    margin-bottom: 4px;
    overflow: hidden;
    font-size: 15px;
    line-height: 1.25;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .dish-card p {
    display: -webkit-box;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .qty-control {
    width: 100%;
    grid-template-columns: 32px 32px 32px;
    justify-self: end;
  }

  .qty-control button {
    min-height: 36px;
    font-size: 18px;
  }

  .qty-control span {
    font-size: 15px;
  }

  .admin-header {
    display: block;
  }

  .admin-header button {
    margin-bottom: 16px;
    width: 100%;
  }
}

@media (max-width: 380px) {
  .dish-card {
    grid-template-columns: 60px minmax(0, 1fr);
  }

  .dish-image {
    width: 60px;
  }

  .qty-control {
    grid-column: 2;
    width: 100%;
    grid-template-columns: 1fr 1fr 1fr;
  }
}
