:root {
  --bg: #f7f4ed;
  --card: #fffaf2;
  --card-2: #ffffff;
  --text: #2c2a26;
  --muted: #756f64;
  --line: #e5dccd;
  --primary: #d85a30;
  --primary-dark: #993c1d;
  --green: #1d9e75;
  --green-dark: #0f6e56;
  --blue: #378add;
  --amber: #ba7517;
  --red: #a32d2d;
  --red-soft: #fcebeb;
  --yellow-bg: #fff4d9;
  --yellow-line: #eed59a;
  --yellow-text: #8d5a08;
  --shadow: 0 18px 45px rgba(87, 61, 35, 0.12);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top left, #fff2dc 0, transparent 34%), var(--bg);
  min-height: 100vh;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

button:disabled:hover {
  transform: none;
}

.app {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 20px;
  align-items: stretch;
  margin-bottom: 18px;
}

.hero-main,
.panel,
.summary-card,
.panel-lite {
  background: rgba(255, 250, 242, 0.92);
  border: 1px solid rgba(149, 105, 63, 0.18);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-main {
  padding: 30px;
  position: relative;
  overflow: hidden;
}

.hero-main::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -60px;
  width: 220px;
  height: 220px;
  background: #fae0d6;
  border-radius: 999px;
  z-index: 0;
}

.hero-main > * {
  position: relative;
  z-index: 1;
}

.eyebrow {
  color: var(--primary-dark);
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 13px;
  margin-bottom: 10px;
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(30px, 5vw, 52px);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.hero-main p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
  max-width: 700px;
}

.hero-tip {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px dashed rgba(149, 105, 63, 0.22);
  color: var(--primary-dark);
  line-height: 1.7;
  font-size: 14px;
}

.hero-side {
  display: grid;
  gap: 14px;
}

.metric-grid {
  display: grid;
  gap: 14px;
}

.metric {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
}

.metric strong {
  display: block;
  font-size: 30px;
  margin-bottom: 4px;
}

.metric span {
  color: var(--muted);
  font-size: 14px;
}

.panel-lite {
  padding: 18px;
}

.share-card h2,
.panel h2,
.section-title {
  margin: 0 0 14px;
  font-size: 20px;
}

.share-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.share-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.share-field,
.share-link-block {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}

.share-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.share-link-box {
  color: var(--text);
  line-height: 1.7;
  word-break: break-all;
  font-size: 14px;
}

.share-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 12px;
}

.system-banner {
  margin-bottom: 18px;
  border-radius: 18px;
  border: 1px solid var(--yellow-line);
  background: var(--yellow-bg);
  color: var(--yellow-text);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.tabs {
  display: flex;
  gap: 10px;
  margin: 18px 0;
  overflow-x: auto;
  padding-bottom: 2px;
}

.tab {
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 12px 18px;
  border-radius: 999px;
  white-space: nowrap;
}

.tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 12px 24px rgba(216, 90, 48, 0.22);
}

.grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
  align-items: start;
}

.panel {
  padding: 20px;
}

.helper {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
  margin-bottom: 14px;
}

.mode-notice {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #fff;
  border: 1px dashed var(--line);
  color: var(--muted);
  line-height: 1.7;
  font-size: 14px;
}

.form {
  display: grid;
  gap: 12px;
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.field textarea {
  min-height: 72px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: rgba(216, 90, 48, 0.56);
  box-shadow: 0 0 0 4px rgba(216, 90, 48, 0.1);
}

.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.primary-btn {
  background: var(--primary);
  color: #fff;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 700;
}

.secondary-btn {
  background: #f2eadf;
  color: var(--primary-dark);
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 700;
}

.ghost-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}

.danger-btn {
  background: var(--red-soft);
  color: var(--red);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.chip {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 14px;
}

.chip.active {
  background: #e1f5ee;
  color: var(--green-dark);
  border-color: #9fe1cb;
  font-weight: 700;
}

.dish-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}

.dish-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  display: grid;
  gap: 12px;
}

.dish-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.dish-name {
  font-size: 18px;
  font-weight: 800;
}

.tag-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: #f6efe6;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.tag.good {
  background: #e1f5ee;
  color: var(--green-dark);
}

.tag.warn {
  background: var(--red-soft);
  color: var(--red);
}

.image-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: #fcf7f0;
}

.image-entry .small {
  margin: 0;
}

.image-link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--blue);
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.image-link:hover {
  color: var(--primary-dark);
  transform: none;
}

a.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.dish-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  display: grid;
  gap: 4px;
}

.recent-pick {
  color: var(--amber);
  font-weight: 600;
}

.assign-box {
  background: #fffaf2;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.assign-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.assign-row select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 10px;
  background: #fff;
}

.current-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pick-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #e6f1fb;
  color: #185fa5;
  font-size: 12px;
}

.summary-list {
  display: grid;
  gap: 12px;
}

.summary-card {
  box-shadow: none;
  padding: 16px;
  background: #fff;
}

.score-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.score {
  font-size: 24px;
  font-weight: 900;
  color: var(--primary-dark);
}

.bar {
  height: 10px;
  background: #f2eadf;
  border-radius: 999px;
  overflow: hidden;
  margin: 10px 0;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--green);
  border-radius: inherit;
}

.small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.meal-plan {
  display: grid;
  gap: 14px;
}

.day-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
}

.day-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.day-title strong {
  font-size: 18px;
}

.meal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.meal-box {
  background: #fffaf2;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.meal-box h3 {
  margin: 0;
  font-size: 15px;
}

.selection-group {
  background: #fff;
  border: 1px solid #eee3d4;
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.selection-group-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.selection-members {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.selection-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 999px;
  background: #e1f5ee;
  color: var(--green-dark);
  font-size: 12px;
}

.selection-chip button {
  width: 18px;
  height: 18px;
  padding: 0;
  line-height: 1;
  border-radius: 999px;
  background: rgba(15, 110, 86, 0.14);
  color: var(--green-dark);
}

.empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.56);
  border: 1px dashed var(--line);
  border-radius: 18px;
}

.hidden {
  display: none !important;
}

.image-modal,
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(30, 25, 19, 0.68);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 25;
}

.image-modal-card,
.modal-card {
  width: min(920px, 100%);
  max-height: min(88vh, 920px);
  overflow: auto;
  background: #fffaf2;
  border: 1px solid rgba(149, 105, 63, 0.18);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 22px;
  display: grid;
  gap: 16px;
}

.modal-card {
  width: min(460px, 100%);
}

.image-modal-head,
.modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.image-modal-head h3,
.modal-head h3 {
  margin: 0 0 6px;
  font-size: 24px;
}

.image-modal-close {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: #f2eadf;
  color: var(--primary-dark);
  font-size: 20px;
  flex: 0 0 auto;
}

.image-stage {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 12px;
}

.image-stage img {
  max-width: 100%;
  max-height: 62vh;
  object-fit: contain;
  border-radius: 12px;
  display: block;
}

.image-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.image-thumb {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 8px;
  display: grid;
  gap: 8px;
  text-align: left;
  color: var(--text);
}

.image-thumb.active {
  border-color: var(--primary);
  box-shadow: 0 8px 20px rgba(216, 90, 48, 0.16);
}

.image-thumb img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.form-error {
  color: var(--red);
  background: var(--red-soft);
  border-radius: 12px;
  padding: 10px 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: #2c2a26;
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, bottom 0.2s ease;
  z-index: 30;
}

.toast.show {
  opacity: 1;
  bottom: 38px;
}

.admin-lock-card {
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 14px;
  display: grid;
  gap: 10px;
}

.admin-lock-card .filters {
  margin-bottom: 0;
}

@media (max-width: 860px) {
  .hero,
  .grid,
  .share-field-row,
  .meal-grid,
  .two {
    grid-template-columns: 1fr;
  }

  .app {
    width: min(100%, calc(100% - 20px));
  }

  .hero-main,
  .panel,
  .panel-lite {
    padding: 18px;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions button {
    width: 100%;
  }
}
