:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --card: #ffffff;
  --line: #d9e2ef;
  --text: #1b2a41;
  --muted: #5d6b82;
  --primary: #2563eb;
  --primary-soft: #e8f0ff;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: linear-gradient(180deg, #eef4ff 0%, var(--bg) 100%);
  color: var(--text);
}

.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 12px 36px;
}

.hero,
.panel,
.group-card,
.summary-card {
  background: var(--card);
  border: 1px solid rgba(217, 226, 239, 0.95);
  box-shadow: var(--shadow);
}

.hero {
  border-radius: 24px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

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

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

h1 {
  font-size: 22px;
}

h2 {
  font-size: 17px;
}

.subtitle,
.section-title p,
.summary-card span,
.price {
  color: var(--muted);
}

.hero-actions,
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.layout {
  display: grid;
  gap: 16px;
}

.panel {
  border-radius: var(--radius);
  padding: 16px;
}

.form-grid,
.groups,
.summary-cards,
.group-meta {
  display: grid;
  gap: 12px;
}

.form-grid {
  grid-template-columns: minmax(132px, 1.15fr) minmax(104px, 0.85fr);
  gap: 10px;
}

.form-grid > * {
  min-width: 0;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

input,
textarea,
button {
  font: inherit;
}

input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
}

input:focus,
textarea:focus {
  outline: 2px solid rgba(37, 99, 235, 0.15);
  border-color: var(--primary);
}

.summary-cards {
  margin-top: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.summary-card {
  border-radius: 15px;
  padding: 12px;
  min-height: 96px;
}

.summary-card strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}

.groups {
  grid-template-columns: 1fr;
}

.group-card {
  border-radius: 16px;
  padding: 10px;
}

.group-header {
  display: flex;
  justify-content: stretch;
  align-items: center;
  gap: 0;
  min-height: 46px;
  width: 100%;
  padding: 0;
  background: #f8fbff;
  border: 1px solid var(--line);
  color: var(--text);
  text-align: left;
}

.group-switch {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
}

.group-switch-text {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.group-status {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.group-body {
  margin-top: 6px;
}

.group-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.group-summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7f9fc;
  font-size: 12px;
}

.group-summary-pill strong {
  font-size: 15px;
}

.group-summary-tip {
  font-size: 11px;
  color: var(--muted);
}

.toggle {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.toggle-inline {
  font-weight: 700;
}

.toggle input {
  width: 18px;
  height: 18px;
}

.group-title-text {
  color: var(--text);
}

.dish-list {
  display: grid;
  gap: 6px;
  padding-right: 2px;
}

.dish-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.dish-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 106px;
  gap: 4px;
  align-items: center;
  padding: 7px 7px 7px 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fafcff;
  min-height: 58px;
}

.dish-name {
  font-weight: 700;
  line-height: 1.2;
  font-size: 13px;
}

.price {
  font-size: 10px;
  margin-top: 1px;
}

.dish-info {
  min-width: 0;
}

.dish-item input,
.group-people {
  text-align: center;
}

.qty-control {
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  align-items: center;
  gap: 4px;
}

.qty-button {
  min-height: 30px;
  padding: 0;
  border-radius: 10px;
  background: #edf2ff;
  color: var(--primary);
  font-size: 16px;
  line-height: 1;
}

.qty-control input[readonly] {
  padding: 6px 4px;
  background: #fff;
}

.more-dishes {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 6px;
  background: #fcfdff;
}

.more-dishes summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  list-style: none;
}

.more-dishes summary::-webkit-details-marker {
  display: none;
}

.more-dishes[open] summary {
  margin-bottom: 8px;
}

.group-people[readonly] {
  background: #f7f9fc;
}

.group-card.expanded .group-header {
  border-color: #bcd0f7;
  background: #eef4ff;
}

.group-card.expanded .group-switch {
  border-color: #bcd0f7;
  background: #eef4ff;
}

.category-summary {
  display: grid;
  gap: 10px;
}

.total-amount {
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f9fc;
  font-weight: 700;
}

.category-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 14px;
  background: var(--primary-soft);
  border-radius: 14px;
}

.category-summary.empty {
  color: var(--muted);
  padding: 16px;
  background: #f8fafc;
  border: 1px dashed var(--line);
  border-radius: 14px;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 11px 16px;
  cursor: pointer;
}

.primary-button {
  background: var(--primary);
  color: #fff;
}

.secondary-button {
  background: #edf2ff;
  color: var(--primary);
}

.result-panel textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfdff;
  line-height: 1.7;
}

.sticky-actions {
  position: sticky;
  top: 8px;
  z-index: 2;
  background: var(--card);
  padding-bottom: 6px;
}

.hidden {
  display: none;
}

@media (max-width: 720px) {
  .app {
    padding: 10px 10px 24px;
  }

  .hero,
  .section-title,
  .hero-actions,
  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero {
    padding: 14px;
  }

  .subtitle {
    font-size: 13px;
  }

  .section-title p {
    font-size: 12px;
  }

  .summary-cards,
  .dish-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-card strong {
    font-size: 24px;
  }

  button {
    width: 100%;
  }

  .result-panel textarea {
    min-height: 280px;
  }
}

@media (max-width: 430px) {
  .form-grid,
  .summary-cards,
  .dish-grid {
    grid-template-columns: 1fr;
  }

  .group-summary-row {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (min-width: 390px) and (max-width: 560px) {
  .summary-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .summary-card {
    min-height: 84px;
  }

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

@media (max-width: 560px) {
  .form-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "date date"
      "time time"
      "guide team";
  }

  .field-date {
    grid-area: date;
  }

  .field-time {
    grid-area: time;
  }

  .field-guide {
    grid-area: guide;
  }

  .field-team {
    grid-area: team;
  }

  .field-guide input,
  .field-team input {
    padding-left: 10px;
    padding-right: 10px;
  }

  .field-date,
  .field-time {
    min-width: 0;
  }
}
