:root {
  --ink: #222326;
  --muted: #62656b;
  --paper: #fffdf8;
  --panel: #ffffff;
  --line: #dedbd2;
  --sage: #456b54;
  --sage-soft: #e6efe8;
  --tomato: #b84934;
  --tomato-soft: #fae7df;
  --mustard: #d49a25;
  --sky: #dcecf3;
  --focus: #245ea8;
  --shadow: 0 18px 45px rgba(46, 43, 37, 0.12);
}

* {
  box-sizing: border-box;
}

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

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

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 14px clamp(16px, 4vw, 42px);
  background: rgba(255, 253, 248, 0.93);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  display: block;
  width: clamp(170px, 24vw, 260px);
  height: auto;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
  white-space: nowrap;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 1rem;
}

.brand span {
  color: var(--muted);
  font-size: 0.82rem;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 63% 34%, #f8dcc1 0 13%, transparent 14%),
    radial-gradient(circle at 36% 60%, #b84934 0 18%, transparent 19%),
    radial-gradient(circle at 64% 65%, #456b54 0 15%, transparent 16%),
    #f2c76f;
  box-shadow: inset 0 0 0 1px rgba(34, 35, 38, 0.1);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary-button,
.ghost-button,
.danger-button,
.icon-button,
.tab {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 40px;
}

.primary-button {
  padding: 0 18px;
  color: #fff;
  background: var(--sage);
  font-weight: 700;
}

.primary-button:hover {
  background: #365744;
}

.ghost-button {
  padding: 0 14px;
  color: var(--ink);
  background: var(--panel);
  border-color: var(--line);
  font-weight: 800;
}

.ghost-button:hover {
  background: #f7f2e8;
}

.danger-button {
  padding: 0 12px;
  color: #7a281b;
  background: var(--tomato-soft);
  border-color: #efc8bc;
  font-weight: 800;
}

.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.user-chip {
  max-width: 180px;
  overflow: hidden;
  padding: 7px 10px;
  border-radius: 999px;
  color: #33443a;
  background: var(--sage-soft);
  font-size: 0.8rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  display: inline-grid;
  width: 42px;
  place-items: center;
  color: var(--ink);
  background: var(--panel);
  border-color: var(--line);
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(235px, 280px) 1fr;
  min-height: calc(100vh - 72px);
}

.filters {
  position: sticky;
  top: 72px;
  align-self: start;
  height: calc(100vh - 72px);
  padding: 24px;
  background: #f7f2e8;
  border-right: 1px solid var(--line);
  overflow: auto;
}

.filter-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

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

h1 {
  margin-bottom: 0;
  font-size: 1.6rem;
}

.filter-head span {
  min-width: 34px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 15px;
}

.field span,
legend {
  color: #3b3d41;
  font-size: 0.82rem;
  font-weight: 800;
}

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

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(36, 94, 168, 0.16);
}

.content {
  padding: 24px clamp(16px, 4vw, 42px) 42px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

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

.tab {
  padding: 0 14px;
  color: var(--muted);
  background: var(--panel);
  border-color: var(--line);
  font-weight: 700;
}

.tab.is-active {
  color: #fff;
  background: var(--tomato);
  border-color: var(--tomato);
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
}

.recipe-card {
  min-width: 0;
}

.card-button {
  display: grid;
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  text-align: left;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 5px 16px rgba(46, 43, 37, 0.06);
}

.card-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.photo,
.food-photo {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}

.photo::after,
.food-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 48%, rgba(0, 0, 0, 0.22));
}

.food-photo span {
  position: absolute;
  z-index: 1;
  left: 14px;
  bottom: 12px;
  color: #fff;
  font-weight: 800;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}

.visual-curry {
  background:
    radial-gradient(circle at 48% 48%, #d68d2a 0 28%, transparent 29%),
    radial-gradient(circle at 39% 42%, #f4d9a8 0 7%, transparent 8%),
    radial-gradient(circle at 61% 47%, #3f7d46 0 7%, transparent 8%),
    radial-gradient(circle at 52% 59%, #ba3c2d 0 6%, transparent 7%),
    radial-gradient(ellipse at 50% 54%, #f6f0dc 0 43%, transparent 44%),
    linear-gradient(135deg, #dcecf3, #f4d8bd);
}

.visual-cake {
  background:
    radial-gradient(circle at 43% 37%, #fff8e8 0 8%, transparent 9%),
    radial-gradient(circle at 58% 40%, #b84934 0 7%, transparent 8%),
    linear-gradient(180deg, transparent 0 38%, #f3cc90 39% 58%, #7c4932 59% 74%, transparent 75%),
    radial-gradient(ellipse at 50% 72%, #efe2c7 0 45%, transparent 46%),
    linear-gradient(135deg, #eef3e9, #f5e1d7);
}

.visual-pasta {
  background:
    repeating-radial-gradient(ellipse at 50% 56%, #f3c761 0 8px, #d49a25 9px 14px, transparent 15px 22px),
    radial-gradient(circle at 39% 42%, #b84934 0 7%, transparent 8%),
    radial-gradient(circle at 65% 53%, #456b54 0 8%, transparent 9%),
    radial-gradient(ellipse at 50% 58%, #faf0d8 0 43%, transparent 44%),
    linear-gradient(135deg, #e4f0ef, #f6ead3);
}

.visual-salad {
  background:
    radial-gradient(circle at 33% 42%, #f3d66b 0 8%, transparent 9%),
    radial-gradient(circle at 48% 49%, #b84934 0 8%, transparent 9%),
    radial-gradient(circle at 61% 39%, #f8f2df 0 9%, transparent 10%),
    repeating-radial-gradient(circle at 50% 53%, #456b54 0 14px, #6f9b63 15px 25px, transparent 26px 39px),
    radial-gradient(ellipse at 50% 56%, #f6f0dc 0 43%, transparent 44%),
    linear-gradient(135deg, #dcecf3, #f4e5c5);
}

.visual-new {
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 255, 255, 0.86) 0 30%, transparent 31%),
    radial-gradient(circle at 43% 45%, #d49a25 0 8%, transparent 9%),
    radial-gradient(circle at 57% 50%, #456b54 0 8%, transparent 9%),
    linear-gradient(135deg, #dcecf3, #f2d4c7);
}

.card-body {
  display: grid;
  gap: 9px;
  padding: 14px;
}

.card-top,
.detail-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.category {
  color: var(--tomato);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.rating {
  color: #66511f;
  font-size: 0.84rem;
  font-weight: 800;
}

h3 {
  margin-bottom: 0;
  font-size: 1.08rem;
  line-height: 1.2;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 999px;
  color: #33443a;
  background: var(--sage-soft);
  font-size: 0.76rem;
  font-weight: 800;
}

.tag.keyword {
  color: #624918;
  background: #f4e5bd;
}

.tag.allergen {
  color: #7a281b;
  background: var(--tomato-soft);
}

.allergen-line {
  min-height: 18px;
  color: var(--muted);
  font-size: 0.8rem;
}

.byline,
.auth-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.recipe-form {
  max-width: 980px;
}

.form-title {
  margin-bottom: 22px;
}

.form-title h2 {
  margin-bottom: 5px;
  font-size: 1.45rem;
}

.form-title p,
.submit-panel p {
  color: var(--muted);
}

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

fieldset {
  margin: 5px 0 18px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
}

legend {
  padding: 0 6px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 8px;
}

.choice {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  font-size: 0.88rem;
  font-weight: 750;
}

.choice input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--sage);
}

.allergens .choice input {
  accent-color: var(--tomato);
}

.preview-row {
  display: grid;
  grid-template-columns: minmax(260px, 380px) 1fr;
  gap: 18px;
  align-items: stretch;
}

.preview-photo {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.submit-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

dialog {
  width: min(920px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

dialog[open] {
  display: block;
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 1000;
  margin: 0;
  transform: translate(-50%, -50%);
}

dialog::backdrop {
  background: rgba(26, 28, 31, 0.42);
}

body.dialog-layer-open::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(26, 28, 31, 0.42);
}

.rc-imageselect,
iframe[src*="recaptcha"] {
  z-index: 2147483647 !important;
}

.detail {
  position: relative;
  background: var(--panel);
}

.close-button {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}

.detail-hero {
  display: grid;
  grid-template-columns: minmax(260px, 42%) 1fr;
}

.detail-hero .photo {
  min-height: 330px;
  aspect-ratio: auto;
}

.detail-copy {
  padding: 30px;
}

.detail-copy h2 {
  margin-bottom: 8px;
  padding-right: 44px;
  font-size: clamp(1.5rem, 2.6vw, 2.2rem);
}

.detail-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 0 30px 30px;
}

.detail-section h3 {
  margin-bottom: 10px;
}

.detail-section ul,
.detail-section ol {
  margin: 0;
  padding-left: 22px;
  color: #393b40;
}

.reviews {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.review-list {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.review {
  padding: 12px;
  border-radius: 8px;
  background: #f7f2e8;
}

.review strong {
  display: block;
  margin-bottom: 4px;
}

.review-form {
  display: grid;
  grid-template-columns: 130px 1fr auto;
  gap: 10px;
  align-items: start;
}

.auth-gate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
}

.auth-gate p {
  margin-bottom: 0;
  color: var(--muted);
}

.auth-card {
  position: relative;
  padding: 24px;
  background: var(--panel);
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  padding-right: 48px;
}

.auth-form {
  display: grid;
  gap: 4px;
  min-width: min(420px, calc(100vw - 72px));
}

.admin-shell {
  max-width: 1160px;
}

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

.admin-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.admin-panel h3 {
  margin-bottom: 14px;
}

.wide-panel {
  grid-column: 1 / -1;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 12px;
}

.admin-list {
  display: grid;
  gap: 8px;
}

.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.admin-row span {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.admin-actions .ghost-button,
.admin-actions .danger-button {
  min-height: 34px;
  padding-inline: 10px;
  font-size: 0.8rem;
}

.admin-row strong,
.admin-row small,
.admin-row > span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-row small {
  color: var(--muted);
}

.report-button {
  margin-top: 12px;
}

.reset-page {
  max-width: 480px;
  margin: 40px auto;
}

.is-hidden {
  display: none;
}

.empty-state {
  padding: 36px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
}

@media (max-width: 850px) {
  .workspace,
  .detail-hero,
  .detail-sections,
  .preview-row,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .wide-panel {
    grid-column: auto;
  }

  .filters {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .form-grid,
  .review-form,
  .inline-form {
    grid-template-columns: 1fr;
  }

  .detail-hero .photo {
    min-height: 240px;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
  }

  .brand span {
    display: none;
  }

  .brand-logo {
    width: 156px;
  }

  .top-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .user-chip {
    max-width: 120px;
  }

  .content,
  .filters {
    padding: 18px;
  }
}
