:root {
  color-scheme: light;
  --ink: #202621;
  --muted: #69716b;
  --line: #dfe6df;
  --paper: #fbfaf6;
  --soft: #f0f4ee;
  --sage: #6f8f7a;
  --terra: #b86f52;
  --amber: #c99642;
  --white: #ffffff;
  --danger: #a94d3f;
  --shadow: 0 18px 60px rgba(34, 42, 36, 0.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px clamp(18px, 4vw, 44px);
  background: rgba(251, 250, 246, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
.topbar.compact { justify-content: space-between; }

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 760; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
}

.nav { display: flex; gap: 16px; margin-left: auto; color: var(--muted); font-size: 14px; }
.nav a:hover { color: var(--ink); }
.lang-toggle { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); }
.lang-toggle button { border: 0; background: transparent; padding: 7px 10px; border-radius: 999px; color: var(--muted); }
.lang-toggle button.active { background: var(--ink); color: var(--white); }

.section { padding: 46px clamp(16px, 4vw, 48px); }
.hero {
  min-height: auto;
  display: grid;
  grid-template-columns: minmax(0, 720px);
  gap: 22px;
  justify-content: center;
  align-items: start;
}

.eyebrow { margin: 0 0 12px; color: var(--terra); font-size: 13px; font-weight: 760; text-transform: uppercase; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0; max-width: 720px; font-size: clamp(40px, 8vw, 76px); line-height: 0.96; letter-spacing: 0; }
h2 { margin: 0; font-size: clamp(26px, 5vw, 42px); line-height: 1; letter-spacing: 0; }
h3 { margin: 0; font-size: 22px; }
.subtitle { max-width: 680px; color: var(--muted); font-size: 17px; line-height: 1.6; }

.analysis-panel {
  display: grid;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  padding: 20px;
  box-shadow: 0 14px 46px rgba(34, 42, 36, 0.1);
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
}
.mode-tabs button {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
}
.mode-tabs button.active { background: var(--ink); color: var(--white); }

.input-mode { display: none; gap: 8px; }
.input-mode.active { display: grid; }
label { display: grid; gap: 8px; color: var(--muted); font-weight: 700; }
textarea, input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  padding: 12px;
}
textarea { resize: vertical; line-height: 1.55; }
select, input { min-height: 46px; }
.helper { margin: 0; color: var(--muted); line-height: 1.5; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line); }
.button.primary { background: var(--ink); color: var(--white); border-color: var(--ink); }
.internal-button {
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 800;
}
.internal-button:hover { border-color: var(--sage); }
.status { min-height: 24px; margin: 0; color: var(--sage); font-weight: 750; }
.status.error { color: var(--danger); }

.section-heading { max-width: 800px; margin-bottom: 22px; }
.compact-heading { margin-bottom: 14px; }
.visual-menu-section { background: var(--soft); }
.summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}
.summary-strip span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  padding: 8px 12px;
  color: var(--muted);
  font-weight: 700;
}

.menu-list {
  display: grid;
  gap: 10px;
  max-width: 820px;
}
.menu-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(34, 42, 36, 0.05);
}
.menu-card.unmatched { border-style: dashed; }
.menu-card-button {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border: 0;
  background: transparent;
  padding: 12px;
  text-align: left;
  color: inherit;
}
.knowledge-image {
  min-height: 96px;
  border-radius: 8px;
  background: linear-gradient(135deg, #d6e1d1, #f2d3b5 54%, #8da89a);
  overflow: hidden;
}
.knowledge-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.menu-card-copy { display: grid; gap: 5px; min-width: 0; }
.order-index {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--terra);
  font-weight: 800;
}
.menu-card h3 { font-size: 18px; line-height: 1.12; }
.menu-card p, .menu-card small { margin: 0; color: var(--muted); }
.menu-card small { font-weight: 700; }
.icon-row { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  padding: 4px 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}
.method-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.method-tag {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  padding: 5px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}
.cooking-profile {
  margin: 0;
  color: var(--muted);
}

.knowledge-card {
  display: grid;
  grid-template-columns: minmax(220px, 0.65fr) minmax(0, 1.35fr);
  gap: 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  padding: 20px;
  box-shadow: var(--shadow);
}
.knowledge-card.empty { display: block; color: var(--muted); box-shadow: none; }
.knowledge-image { min-height: 320px; }
.knowledge-copy { display: grid; align-content: start; gap: 12px; }
.knowledge-copy h3 { font-size: clamp(32px, 5vw, 54px); line-height: 1; }
.original-name, .verdict { margin: 0; color: var(--muted); line-height: 1.55; }
.verdict { color: var(--ink); font-weight: 760; }
.notice {
  margin: 0;
  border-left: 3px solid var(--amber);
  padding: 8px 12px;
  background: #fff8e8;
  color: var(--muted);
}
.knowledge-copy dl {
  display: grid;
  gap: 12px;
  margin: 0;
}
.knowledge-copy dt {
  color: var(--terra);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.knowledge-copy dd {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.55;
}
.composition-list {
  display: grid;
  gap: 6px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.composition-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}

.footer { display: flex; justify-content: space-between; gap: 14px; padding: 28px clamp(18px, 5vw, 70px); border-top: 1px solid var(--line); color: var(--muted); }
.footer.compact { font-size: 14px; }
.empty-state { color: var(--muted); }

.pdc-section {
  background: linear-gradient(180deg, var(--paper), var(--soft));
}
.pdc-shell {
  display: grid;
  gap: 22px;
  max-width: 980px;
  margin: 0 auto;
}
.pdc-heading {
  display: grid;
  gap: 10px;
  max-width: 780px;
}
.pdc-heading p { margin: 0; color: var(--muted); line-height: 1.6; }
.pdc-form,
.pdc-intervention {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  padding: 18px;
  box-shadow: 0 14px 46px rgba(34, 42, 36, 0.08);
}
.agent-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.agent-picker legend {
  padding: 0 6px;
  color: var(--terra);
  font-weight: 800;
}
.agent-picker label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}
.agent-picker input { width: auto; min-height: auto; }
.pdc-grouping {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  padding: 14px;
}
.pdc-grouping h3 { font-size: 20px; }
.group-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.group-tools .button {
  min-height: 40px;
  background: var(--white);
}
.custom-groups {
  display: grid;
  gap: 12px;
}
.role-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.role-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  padding: 14px;
  text-align: left;
}
.role-card.selected {
  border-color: var(--sage);
  box-shadow: 0 0 0 2px rgba(111, 143, 122, 0.18);
}
.role-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}
.role-card h4 {
  margin: 0;
  font-size: 17px;
}
.role-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}
.role-check {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: transparent;
}
.role-card.selected .role-check {
  background: var(--sage);
  border-color: var(--sage);
  color: var(--white);
}
.role-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.role-tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  padding: 4px 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.role-detail {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.role-detail summary {
  color: var(--terra);
  cursor: pointer;
  font-weight: 850;
}
.role-detail dl {
  display: grid;
  gap: 7px;
  margin: 10px 0 0;
}
.role-detail dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}
.role-detail dd {
  margin: 2px 0 0;
  color: var(--ink);
  line-height: 1.5;
}
.auto-group-preview {
  display: grid;
  gap: 10px;
}
.auto-group-card {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--white);
  padding: 12px;
}
.auto-group-card h4 {
  margin: 0 0 8px;
  font-size: 15px;
}
.auto-group-card ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}
.custom-group-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  padding: 14px;
}
.custom-group-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.custom-group-card header h4 {
  margin: 0;
  font-size: 16px;
}
.remove-group {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--danger);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
}
.group-member-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.group-member-grid label,
.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
}
.group-member-grid input,
.toggle-row input {
  width: auto;
  min-height: auto;
}
.pdc-rounds {
  display: grid;
  gap: 14px;
}
.pdc-round {
  display: grid;
  gap: 12px;
}
.pdc-round-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-weight: 800;
}
.pdc-card,
.pdc-user-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  padding: 16px;
  box-shadow: 0 8px 24px rgba(34, 42, 36, 0.06);
}
.pdc-user-card {
  border-left: 4px solid var(--sage);
  background: #f7faf5;
}
.pdc-card h3,
.pdc-user-card h3 {
  margin-bottom: 4px;
  font-size: 20px;
}
.pdc-role,
.pdc-members {
  margin: 0 0 12px;
  color: var(--terra);
  font-size: 13px;
  font-weight: 800;
}
.participant-kind {
  display: inline-flex;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  padding: 5px 8px;
  color: var(--sage);
  font-size: 12px;
  font-weight: 850;
}
.member-list {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 13px;
}
.pdc-card dl {
  display: grid;
  gap: 10px;
  margin: 0;
}
.pdc-card dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}
.pdc-card dd {
  margin: 3px 0 0;
  color: var(--ink);
  line-height: 1.55;
}
.pdc-intervention h3 { font-size: 22px; }

@media (max-width: 980px) {
  .topbar { align-items: flex-start; flex-wrap: wrap; }
  .nav { order: 3; width: 100%; overflow-x: auto; margin-left: 0; padding-bottom: 3px; }
  .lang-toggle { margin-left: auto; }
  .hero, .knowledge-card { grid-template-columns: 1fr; }
  .agent-picker, .group-member-grid, .role-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .section { padding: 34px 16px; }
  .hero { min-height: auto; }
  .menu-card-button { grid-template-columns: 32px minmax(0, 1fr); }
  .mode-tabs { grid-template-columns: 1fr; border-radius: 12px; }
  .mode-tabs button { border-radius: 8px; }
  .agent-picker, .group-member-grid, .role-grid { grid-template-columns: 1fr; }
  .footer { flex-direction: column; }
}
