:root {
  color-scheme: light;
  --ink: #27221d;
  --muted: #756c62;
  --line: #ddd3c7;
  --paper: #fffdf8;
  --soft: #f4eee5;
  --sage: #496f5d;
  --sage-dark: #315341;
  --tomato: #b44b3d;
  --gold: #d79d39;
  --blue: #3f6f91;
  --shadow: 0 18px 45px rgba(51, 39, 25, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  border: 0;
  border-radius: 8px;
  background: var(--sage);
  color: #fff;
  cursor: pointer;
  min-height: 42px;
  padding: 0 16px;
  font-weight: 700;
}

button:hover {
  background: var(--sage-dark);
}

button.ghost {
  background: transparent;
  color: var(--sage-dark);
  border: 1px solid var(--line);
}

button.danger {
  color: var(--tomato);
}

button.icon-button {
  width: 42px;
  padding: 0;
  font-size: 22px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(63, 111, 145, 0.16);
}

textarea {
  min-height: 148px;
  resize: vertical;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: center;
  padding: 28px clamp(18px, 4vw, 54px) 20px;
  border-bottom: 1px solid var(--line);
}

.topbar h1,
.section-heading h2,
.recipe-card h3 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  max-width: 760px;
  font-size: clamp(28px, 4vw, 54px);
  line-height: 1.02;
}

.top-actions,
.form-actions,
.export-actions,
.section-heading,
.section-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-panel {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  min-width: min(420px, 42vw);
  text-align: right;
}

.sync-status {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
}

.section-heading {
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-heading.compact {
  align-items: flex-start;
}

.eyebrow,
.side-label,
.source {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.capture-panel {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(320px, 1.3fr);
  min-height: 360px;
  border-bottom: 1px solid var(--line);
  background: var(--soft);
}

.capture-image {
  min-height: 360px;
  background:
    linear-gradient(90deg, rgba(255, 253, 248, 0.05), rgba(255, 253, 248, 0.68)),
    url("./assets/kitchen-planning.png") center / cover;
}

.capture-form {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: clamp(18px, 4vw, 46px);
}

.bookmarklet-panel {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 18px clamp(18px, 4vw, 54px);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.bookmarklet-panel h2,
.bookmarklet-panel p {
  margin: 0;
}

.bookmarklet-panel h2 {
  font-size: 22px;
  line-height: 1.2;
}

.bookmarklet-panel p:not(.eyebrow) {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.bookmarklet-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 42px;
  border-radius: 8px;
  background: var(--sage);
  color: #fff;
  padding: 0 16px;
  font-weight: 800;
  text-decoration: none;
}

.bookmarklet-button:hover {
  background: var(--sage-dark);
}

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

.workspace {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 320px;
  gap: 22px;
  padding: 24px clamp(18px, 4vw, 54px) 42px;
}

.filters,
.shopping-panel {
  position: sticky;
  top: 16px;
  align-self: start;
  display: grid;
  gap: 18px;
}

.filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip,
.tag {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 800;
}

.filter-chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.recipe-list {
  display: grid;
  gap: 14px;
}

.recipe-result {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.recipe-title-button {
  display: grid;
  gap: 6px;
  width: 100%;
  min-height: 74px;
  padding: 16px 18px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.recipe-title-button:hover {
  background: #f8f2ea;
}

.recipe-title-button strong {
  font-size: 21px;
  line-height: 1.2;
}

.result-meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.recipe-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.recipe-card h3 {
  font-size: 22px;
  line-height: 1.18;
}

.edit-card {
  display: grid;
  gap: 14px;
}

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

.edit-card textarea {
  min-height: 150px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.ingredient-block {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.ingredient-button {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  min-height: 40px;
  border: 1px solid var(--line);
  background: #fffdf8;
  color: var(--ink);
  text-align: left;
  padding: 9px 10px;
  font-weight: 650;
}

.ingredient-button:hover {
  background: #f3eadf;
}

.ingredient-button span:last-child {
  color: var(--sage);
  flex: 0 0 auto;
}

details {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

summary {
  cursor: pointer;
  font-weight: 850;
  color: var(--sage-dark);
}

.instructions {
  margin: 10px 0 0;
  padding-left: 22px;
  color: #473f38;
  line-height: 1.5;
}

.shopping-list {
  display: grid;
  gap: 8px;
  min-height: 84px;
}

.shopping-item {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: start;
  gap: 9px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.shopping-item input {
  width: auto;
  margin-top: 3px;
}

.shopping-item p {
  margin: 0;
  font-weight: 750;
  line-height: 1.3;
}

.shopping-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.shopping-item.done p {
  text-decoration: line-through;
  color: var(--muted);
}

.remove-item {
  width: 30px;
  min-height: 30px;
  padding: 0;
  background: transparent;
  color: var(--tomato);
  border: 1px solid var(--line);
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.65);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10;
  max-width: min(360px, calc(100vw - 40px));
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .shopping-panel {
    position: static;
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .topbar,
  .account-panel,
  .card-head,
  .card-actions,
  .section-heading,
  .section-actions,
  .form-actions,
  .export-actions,
  .bookmarklet-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .capture-panel,
  .workspace,
  .form-grid,
  .edit-grid {
    grid-template-columns: 1fr;
  }

  .capture-image {
    min-height: 190px;
  }

  .filters {
    position: static;
  }

  .account-panel {
    min-width: 0;
    text-align: left;
  }
}
