:root {
  --primary: #4f8cff;
  --primary-strong: #2358d6;
  --primary-soft: #eaf2ff;
  --accent: #8dd7ff;
  --accent-soft: #f5f9ff;
  --ink: #25212b;
  --muted: #9a94a5;
  --line: #e9edf6;
  --bg: #f7f9ff;
  --card: #ffffff;
  --shadow: 0 18px 42px rgba(57, 72, 103, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body[data-identity="lky"] {
  --primary: #4f8cff;
  --primary-strong: #2358d6;
  --primary-soft: #eaf2ff;
  --accent: #8dd7ff;
  --accent-soft: #f5f9ff;
  --order-tint: #edf5ff;
  --order-line: #80b8ff;
}

body[data-identity="zyh"] {
  --primary: #ff7cab;
  --primary-strong: #db4c82;
  --primary-soft: #fff0f6;
  --accent: #ffc1d8;
  --accent-soft: #fff8fb;
  --order-tint: #fff0f7;
  --order-line: #ff9ac1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 0%, var(--primary-soft), transparent 28rem),
    radial-gradient(circle at 90% 10%, var(--accent-soft), transparent 24rem),
    linear-gradient(180deg, #fbfcff 0%, #ffffff 48%);
  transition: background 0.25s ease;
}

body[data-authenticated="false"] .phone-shell,
body[data-authenticated="false"] .cart-bar {
  display: none;
}

body[data-authenticated="true"] .login-screen {
  display: none;
}

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

button {
  border: 0;
  cursor: pointer;
}

.login-screen {
  width: min(100%, 480px);
  min-height: 100vh;
  display: grid;
  place-items: center;
  margin: 0 auto;
  padding: 28px 18px;
  background:
    radial-gradient(circle at 18% 8%, rgba(255, 255, 255, 0.92), transparent 10rem),
    linear-gradient(160deg, var(--primary), var(--accent));
  box-shadow: 0 0 42px rgba(57, 72, 103, 0.12);
}

.login-card {
  width: 100%;
  padding: 24px 18px 18px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 24px 60px rgba(57, 72, 103, 0.18);
  backdrop-filter: blur(18px);
}

.login-badge {
  display: inline-flex;
  padding: 7px 11px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.login-card h1 {
  margin: 18px 0 8px;
  font-size: 28px;
  line-height: 1.18;
}

.login-card p {
  margin: 0;
  color: #655d6f;
  line-height: 1.6;
  font-size: 14px;
}

.login-users {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 22px 0 16px;
}

.login-user {
  display: grid;
  gap: 8px;
  place-items: center;
  min-height: 108px;
  border: 1px solid var(--line);
  border-radius: 22px;
  color: var(--muted);
  background: #fff;
  box-shadow: 0 12px 24px rgba(57, 72, 103, 0.06);
}

.login-user span {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  font-size: 22px;
  font-weight: 900;
}

.login-user.active {
  color: var(--primary-strong);
  border-color: color-mix(in srgb, var(--primary) 36%, var(--line));
  background: var(--primary-soft);
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-error {
  min-height: 18px;
  color: #d94c61 !important;
  font-size: 12px !important;
}

.phone-shell {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  background: linear-gradient(180deg, var(--accent-soft), #fff 34%);
  position: relative;
  box-shadow: 0 0 42px rgba(57, 72, 103, 0.12);
}

.hero {
  height: 234px;
  padding: max(16px, env(safe-area-inset-top)) 18px 0;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 92%, #fff), var(--accent)),
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.8), transparent 15rem);
}

.hero::after {
  content: "";
  position: absolute;
  right: -30px;
  bottom: -46px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
}

.hero__content {
  position: relative;
  z-index: 2;
  padding-top: 20px;
  color: #fff;
}

.hero__eyebrow {
  display: inline-flex;
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(14px);
  letter-spacing: 0.08em;
  font-size: 13px;
}

.hero h1 {
  margin: 18px 0 8px;
  max-width: 300px;
  font-size: 31px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.hero p {
  margin: 0;
  max-width: 292px;
  color: rgba(255, 255, 255, 0.86);
  line-height: 1.65;
  font-size: 14px;
}

.hero__chips {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.hero__chips span {
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--primary-strong);
  background: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 800;
}

.orb {
  position: absolute;
  border-radius: 38% 62% 60% 40%;
  background: rgba(255, 255, 255, 0.22);
  animation: float 7s ease-in-out infinite;
}

.orb--one {
  top: 28px;
  right: 36px;
  width: 72px;
  height: 72px;
}

.orb--two {
  right: 106px;
  bottom: 38px;
  width: 34px;
  height: 34px;
  animation-delay: -2s;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(-10px) rotate(8deg);
  }
}

.shop-card {
  margin-top: -28px;
  min-height: calc(100vh - 206px);
  padding: 18px 0 96px;
  position: relative;
  z-index: 2;
  border-radius: 28px 28px 0 0;
  background: var(--card);
  box-shadow: 0 -14px 34px rgba(57, 72, 103, 0.08);
}

.shop-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
}

.avatar {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 2px solid #fff;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  box-shadow: 0 10px 22px color-mix(in srgb, var(--primary) 28%, transparent);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.shop-title {
  min-width: 0;
  flex: 1;
}

.shop-title h1 {
  margin: 4px 0 2px;
  font-size: 21px;
  letter-spacing: 0.02em;
}

.shop-title p,
.notice {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.level {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 7px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  font-size: 12px;
  font-weight: 700;
}

.identity-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8faff;
}

.identity-option {
  min-width: 46px;
  height: 32px;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 900;
}

.identity-option.active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  box-shadow: 0 8px 16px color-mix(in srgb, var(--primary) 26%, transparent);
}

.logout-button {
  height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  font-size: 12px;
  font-weight: 900;
}

.notice {
  margin: 14px 18px 10px;
  padding: 11px 13px;
  border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--line));
  border-radius: 16px;
  background: var(--primary-soft);
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 0 18px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f9fbff;
}

.tab {
  flex: 1;
  padding: 10px 0;
  border-radius: 13px;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
}

.tab.active {
  color: var(--primary-strong);
  background: #fff;
  box-shadow: 0 8px 16px rgba(57, 72, 103, 0.08);
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 18px;
}

.ghost-button,
.search {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
}

.ghost-button {
  padding: 0 14px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  font-weight: 700;
}

.search {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
  padding: 0 12px;
  color: var(--muted);
  background: #f8faff;
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.page--menu {
  height: calc(100vh - 394px);
  min-height: 420px;
  overflow: hidden;
}

.category-list {
  width: 104px;
  height: 100%;
  float: left;
  overflow-y: auto;
  padding: 4px 8px 16px 12px;
  background: linear-gradient(180deg, #fbfdff, #fff);
}

.category-button {
  width: 100%;
  min-height: 54px;
  margin-bottom: 8px;
  padding: 9px 10px;
  color: #8f8997;
  background: transparent;
  border-radius: 16px;
  text-align: center;
  font-weight: 700;
}

.category-button.active {
  color: var(--primary-strong);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 18%, transparent);
}

.dish-list {
  height: 100%;
  overflow-y: auto;
  padding: 0 14px 18px 8px;
}

.dish-section-title {
  margin: 0;
  padding: 6px 0 10px;
  background: #fff;
  color: var(--ink);
  font-size: 17px;
  position: sticky;
  top: 0;
  z-index: 1;
}

.dish-card {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 38px;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 12px 24px rgba(57, 72, 103, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.dish-card:active {
  transform: scale(0.98);
  box-shadow: 0 8px 16px rgba(57, 72, 103, 0.08);
}

.dish-image {
  width: 86px;
  height: 86px;
  object-fit: contain;
  border-radius: 20px;
  background:
    radial-gradient(circle at 35% 30%, #fff, transparent 45%),
    var(--accent-soft);
}

.dish-name {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.25;
}

.dish-meta {
  color: var(--muted);
  font-size: 12px;
}

.dish-actions {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.add-button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  font-size: 24px;
  line-height: 1;
  box-shadow: 0 8px 16px color-mix(in srgb, var(--primary) 28%, transparent);
}

.delete-dish-button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #d94c61;
  background: #fff2f5;
  font-size: 18px;
  line-height: 1;
  font-weight: 900;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 10px;
}

.section-title h2 {
  margin: 0;
  font-size: 18px;
}

.link-button {
  color: var(--primary-strong);
  background: transparent;
  font-size: 13px;
}

.order-list {
  padding: 0 18px 24px;
}

.page--create {
  padding-bottom: 20px;
}

.ai-form {
  display: grid;
  gap: 12px;
  padding: 0 18px 18px;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px;
  gap: 10px;
}

.reference-preview,
.generated-card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 12px 24px rgba(57, 72, 103, 0.06);
}

.reference-preview {
  padding: 10px;
}

.reference-preview img,
.generated-preview {
  width: 88px;
  height: 88px;
  border-radius: 18px;
  background: var(--accent-soft);
}

.generated-preview {
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.95), transparent 38%),
    linear-gradient(135deg, var(--primary-soft), var(--accent-soft));
}

.generated-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 18px;
}

.generated-placeholder {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  color: var(--primary-strong);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.82), 0 10px 24px rgba(57, 72, 103, 0.08);
  font-size: 26px;
}

.generated-card--loading .generated-preview::after {
  content: "";
  position: absolute;
  inset: -45%;
  background: conic-gradient(from 0deg, transparent, rgba(255, 255, 255, 0.88), transparent 32%);
  animation: previewSpin 1.2s linear infinite;
}

.generated-card--loading .generated-placeholder {
  position: relative;
  z-index: 1;
}

@keyframes previewSpin {
  to {
    transform: rotate(360deg);
  }
}

.reference-preview strong,
.generated-card h3 {
  display: block;
  margin: 0 0 6px;
  font-size: 15px;
}

.reference-preview p,
.generated-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.advanced {
  padding: 12px 14px;
  border: 1px dashed color-mix(in srgb, var(--primary) 34%, var(--line));
  border-radius: 18px;
  background: #fff;
}

.advanced summary {
  color: var(--primary-strong);
  cursor: pointer;
  font-weight: 900;
}

.advanced .field {
  margin-top: 12px;
}

.credentials-panel {
  background: linear-gradient(135deg, var(--primary-soft), #fff);
}

.helper-text {
  margin: 10px 0 0;
  color: #655d6f;
  font-size: 12px;
  line-height: 1.6;
}

.generation-status {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 24px rgba(57, 72, 103, 0.06);
}

.generation-status strong {
  color: var(--primary-strong);
}

.generation-status p {
  margin: 7px 0 10px;
  color: #655d6f;
  font-size: 13px;
  line-height: 1.5;
}

.generation-status ol {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.generation-status li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.generation-status li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d9dce8;
}

.generation-status li.active {
  color: var(--primary-strong);
  font-weight: 800;
}

.generation-status li.active::before {
  background: var(--primary);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--primary) 16%, transparent);
}

.generation-status li.done {
  color: #25a06a;
}

.generation-status li.done::before {
  background: #25a06a;
}

.generation-status li.error {
  color: #d94c61;
}

.generation-status li.error::before {
  background: #d94c61;
}

.generated-card {
  margin: 0 18px 22px;
  padding: 12px;
}

.generated-card .secondary-action {
  width: 92px;
  height: 36px;
  margin-top: 10px;
}

.empty {
  margin: 20px 0;
  padding: 24px;
  border-radius: 22px;
  color: var(--muted);
  background: #fbf9fc;
  text-align: center;
}

.order-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(73, 45, 84, 0.06);
}

.order-card {
  margin-bottom: 12px;
  padding: 14px;
  position: relative;
  overflow: hidden;
}

.order-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--order-color, var(--primary));
}

.order-card--lky {
  --order-color: #4f8cff;
  background: linear-gradient(135deg, #fff, #edf5ff);
}

.order-card--zyh {
  --order-color: #ff7cab;
  background: linear-gradient(135deg, #fff, #fff0f7);
}

.order-badge {
  display: inline-flex;
  margin-bottom: 8px;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--order-color, var(--primary-strong));
  background: rgba(255, 255, 255, 0.74);
  font-size: 12px;
  font-weight: 900;
}

.order-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.order-card p {
  margin: 6px 0;
  color: #655d6f;
  font-size: 13px;
}

.order-time {
  color: var(--muted);
  font-size: 12px;
}

.cart-bar {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 20;
  width: min(calc(100% - 24px), 456px);
  height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px 76px;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(238, 234, 243, 0.8);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  transform: translateX(-50%);
  box-shadow: 0 12px 28px rgba(73, 45, 84, 0.16);
  backdrop-filter: blur(14px);
}

.cart-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.cart-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-soft);
}

#cartText {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
}

.secondary-action,
.primary-action {
  height: 42px;
  border-radius: 999px;
  font-weight: 800;
}

.secondary-action {
  color: var(--primary-strong);
  border: 1px solid var(--primary);
  background: #fff;
}

.primary-action {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
}

.primary-action:disabled {
  color: #bdb8c6;
  background: #f1eff4;
}

.drawer-mask {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(37, 33, 43, 0.32);
}

.drawer {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 31;
  width: min(100%, 480px);
  max-height: 84vh;
  overflow-y: auto;
  padding: 12px 18px max(20px, env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0;
  background: #fff;
  transform: translateX(-50%);
  box-shadow: 0 -18px 42px rgba(73, 45, 84, 0.16);
}

.drawer-handle {
  width: 42px;
  height: 5px;
  margin: 0 auto 12px;
  border-radius: 999px;
  background: #e6e1ec;
}

.drawer h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.cart-items {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.cart-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fbf9fc;
}

.cart-line button {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: var(--primary-strong);
  background: #fff;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: #625b6a;
  font-size: 13px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 12px;
  outline: 0;
  background: #fff;
}

.field textarea {
  resize: vertical;
}

.primary-action--wide {
  width: 100%;
  height: 48px;
  margin-top: 4px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  z-index: 50;
  max-width: min(80%, 360px);
  padding: 10px 14px;
  border-radius: 999px;
  color: #fff;
  background: rgba(37, 33, 43, 0.86);
  opacity: 0;
  transform: translate(-50%, 16px);
  transition: 0.2s ease;
  pointer-events: none;
  font-size: 13px;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (min-width: 720px) {
  body {
    padding: 24px 0;
  }

  .phone-shell {
    min-height: calc(100vh - 48px);
    border-radius: 32px;
    overflow: hidden;
  }

  .cart-bar {
    bottom: 36px;
  }
}
