:root {
  --ink: #101828;
  --muted: #667085;
  --line: #d9e1ea;
  --soft-line: #edf2f7;
  --panel: #ffffff;
  --page: #f6f8fb;
  --green: #15803d;
  --green-dark: #116832;
  --green-soft: #e8f7ee;
  --gold: #f2b705;
  --blue: #47637d;
  --shadow: 0 16px 40px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

button {
  min-height: 2.6rem;
  border: 0;
  border-radius: 8px;
  padding: 0 1rem;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

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

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  min-height: 5.25rem;
  border-bottom: 1px solid var(--soft-line);
  padding: 0 2.25rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.03);
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink);
  text-decoration: none;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 2px solid var(--green);
  border-radius: 8px;
  color: var(--green);
  font-size: 1.35rem;
  line-height: 1;
}

.site-brand strong {
  display: block;
  font-size: 1.55rem;
  line-height: 1;
}

.site-brand small {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-left: auto;
}

.site-nav a {
  color: #344054;
  font-weight: 800;
  text-decoration: none;
}

.site-nav a.is-active {
  color: var(--green);
}

.account-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: auto;
  border: 0;
  padding: 0;
  background: transparent;
  color: #344054;
}

.account-pill:hover {
  background: transparent;
  color: var(--green);
}

.account-pill span {
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-weight: 900;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(23rem, 0.9fr) minmax(32rem, 1.3fr);
  gap: 1.25rem;
  width: min(1500px, calc(100% - 4rem));
  margin: 0 auto;
  padding: 1.5rem 0 2rem;
}

.app-banner {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  padding: 1.1rem 1.25rem;
  background: #fff;
  box-shadow: var(--shadow);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand-mark {
  display: none;
}

.app-banner h1 {
  margin: 0;
  font-size: 1.8rem;
  line-height: 1.1;
}

.app-banner p,
p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.banner-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
}

.banner-tags span {
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  background: var(--green-soft);
  color: var(--green);
  font-size: 0.85rem;
  font-weight: 900;
}

.recipe-panel {
  min-width: 0;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.input-panel,
.output-panel {
  padding: 0;
}

.serving-converter,
.ingredient-scaling,
.smart-rounding,
.recipe-import-heading,
.import-tabs,
.import-mode,
.import-status,
.recipe-entry,
.actions {
  padding-inline: 1.25rem;
}

.serving-converter,
.ingredient-scaling,
.smart-rounding {
  display: grid;
  gap: 0.9rem;
  border-bottom: 1px solid var(--soft-line);
  padding-block: 1.25rem;
  background: #fff;
}

.serving-converter {
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

.panel-heading {
  margin-bottom: 0.8rem;
}

.panel-heading.compact {
  margin-bottom: 0;
}

h2,
h3 {
  margin: 0;
  color: var(--ink);
}

h2 {
  font-size: 1.25rem;
  line-height: 1.2;
}

h3 {
  font-size: 1.65rem;
}

.serving-grid,
.ingredient-scale-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

.ingredient-scale-grid {
  grid-template-columns: 0.72fr 1fr 1.1fr;
}

label {
  display: grid;
  gap: 0.45rem;
  color: #344054;
  font-size: 0.86rem;
  font-weight: 800;
}

input,
select,
textarea,
.recipe-output {
  width: 100%;
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

input,
select {
  height: 3rem;
  padding: 0 0.85rem;
}

textarea {
  min-height: 7rem;
  padding: 0.9rem;
  resize: vertical;
  line-height: 1.55;
}

textarea:focus,
input:focus,
select:focus {
  outline: 3px solid rgba(21, 128, 61, 0.16);
  border-color: var(--green);
}

.multiplier-summary,
.single-ingredient-result {
  border: 1px solid #ccebd6;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 900;
}

.unit-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.unit-list span {
  border: 1px solid var(--soft-line);
  border-radius: 999px;
  padding: 0.3rem 0.55rem;
  background: #f8fafc;
  color: #475467;
  font-size: 0.78rem;
  font-weight: 800;
}

.recipe-import-heading {
  padding-top: 1.25rem;
  padding-bottom: 0;
}

.input-panel > .recipe-import-heading:first-child {
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

.import-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-top: 0.6rem;
  border-bottom: 1px solid var(--line);
}

.import-tab {
  min-height: 3rem;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #475467;
  text-align: center;
}

.import-tab:hover,
.import-tab.is-active {
  border-bottom-color: var(--green);
  background: transparent;
  color: var(--green);
}

.import-tab:disabled {
  display: none;
}

.import-mode {
  display: none;
  gap: 0.75rem;
  padding-top: 1rem;
  padding-bottom: 0.4rem;
}

.import-mode.is-active {
  display: grid;
}

.url-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
}

.full-recipe-text {
  min-height: 7rem;
}

.server-hint,
.import-status {
  min-height: 1rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.server-hint:empty,
.import-status:empty {
  display: none;
}

.import-status[data-tone="success"] {
  color: var(--green);
  font-weight: 800;
}

.import-status[data-tone="error"] {
  color: #c2410c;
  font-weight: 800;
}

.recipe-entry {
  padding-top: 0.5rem;
}

.recipe-entry textarea {
  min-height: 13rem;
}

.rounding-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.rounding-toggle label {
  display: flex;
  align-items: center;
  min-height: 3.2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  background: #fff;
  cursor: pointer;
}

.rounding-toggle label:has(input:checked) {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

.rounding-toggle input {
  width: auto;
  height: auto;
  margin: 0;
  accent-color: var(--green);
}

.actions {
  display: flex;
  gap: 0.75rem;
  padding-top: 1rem;
  padding-bottom: 1.25rem;
}

button.secondary,
.icon-button {
  border: 1px solid var(--line);
  background: #fff;
  color: #344054;
}

button.secondary:hover,
.icon-button:hover {
  background: #f8fafc;
}

.output-panel {
  align-self: start;
  overflow: hidden;
}

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--soft-line);
  padding: 1.25rem;
}

.output-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.print-button {
  background: var(--green);
}

.scale-meter {
  overflow: hidden;
  height: 0.35rem;
  background: #edf2f7;
}

.scale-meter div {
  width: 0;
  height: 100%;
  max-width: 100%;
  background: var(--green);
  transition: width 180ms ease;
}

.recipe-summary-card {
  display: grid;
  grid-template-columns: 13.5rem minmax(0, 1fr);
  gap: 1.4rem;
  padding: 1.5rem 1.25rem;
}

.recipe-logo-card {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(circle at 72% 24%, rgba(242, 183, 5, 0.26), transparent 24%),
    linear-gradient(135deg, #e8f7ee, #ffffff 54%, #dbeafe);
  box-shadow: 0 10px 28px rgba(16, 24, 40, 0.12);
}

.recipe-logo-mark {
  display: grid;
  place-items: center;
  width: 5.2rem;
  height: 5.2rem;
  border: 3px solid var(--green);
  border-radius: 50%;
  background: #fff;
  color: var(--green);
  font-size: 2.4rem;
  font-weight: 900;
}

.recipe-logo-line,
.recipe-logo-dot {
  position: absolute;
  display: block;
  border-radius: 999px;
  background: var(--green);
}

.recipe-logo-line {
  right: 1.1rem;
  bottom: 1.1rem;
  width: 4.5rem;
  height: 0.45rem;
}

.recipe-logo-dot {
  left: 1.1rem;
  top: 1.1rem;
  width: 1rem;
  height: 1rem;
  background: var(--gold);
}

.recipe-summary-card p {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-top: 0.9rem;
  font-size: 1.05rem;
}

#outputTargetServings,
.converted-value {
  color: var(--green);
  font-weight: 900;
}

.recipe-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  margin-top: 1rem;
  color: #475467;
  font-weight: 700;
}

.converted-tabs {
  display: flex;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  margin: 0 1.25rem;
  overflow: hidden;
}

.converted-tabs button {
  min-height: 2.8rem;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  background: #fff;
  color: #344054;
}

.converted-tabs button.is-active {
  border-bottom-color: var(--green);
  color: var(--green);
}

.converted-view {
  display: none;
}

.converted-view.is-active {
  display: block;
}

.converted-table-wrap {
  margin: 0 1.25rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  overflow: auto;
}

.converted-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 42rem;
  font-size: 0.95rem;
}

.converted-table th,
.converted-table td {
  border-bottom: 1px solid var(--soft-line);
  padding: 0.8rem 0.9rem;
  text-align: left;
  vertical-align: middle;
}

.converted-table th {
  color: #344054;
  font-size: 0.86rem;
}

.converted-table tr:last-child td {
  border-bottom: 0;
}

.instruction-list {
  display: grid;
  gap: 0.85rem;
  margin: 0 1.25rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  padding: 1rem 1.25rem 1rem 2.8rem;
  background: #fff;
}

.instruction-list li {
  padding-left: 0.2rem;
  line-height: 1.6;
}

.instruction-list li::marker {
  color: var(--green);
  font-weight: 900;
}

.ingredient-name-cell {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 800;
}

.ingredient-dot {
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border: 1px solid #cfe3d7;
  border-radius: 6px;
  background: #f0fbf4;
  color: var(--green);
  font-size: 0.82rem;
}

.smart-tip {
  margin: 0 1.25rem 1.25rem;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 1rem;
  background: #fffbeb;
}

.smart-tip strong {
  display: block;
  margin-bottom: 0.35rem;
}

.recipe-output {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.guide-panel {
  grid-column: 1 / -1;
  padding: 1.25rem;
}

.guide-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.guide-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.guide-filters button {
  min-height: 2.35rem;
  border: 1px solid var(--line);
  background: #fff;
  color: #344054;
}

.guide-filters button:hover,
.guide-filters button.is-active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

.guide-layout {
  display: grid;
  grid-template-columns: minmax(18rem, 0.95fr) minmax(0, 1.35fr);
  gap: 1rem;
}

.guide-subheader {
  margin: 1.35rem 0 1rem;
  border-top: 1px solid var(--soft-line);
  padding-top: 1.25rem;
}

.guide-subheader h3 {
  font-size: 1.2rem;
}

.guide-subheader p {
  margin-top: 0.3rem;
}

.guide-list {
  display: grid;
  gap: 0.7rem;
  align-content: start;
}

.guide-card {
  display: grid;
  gap: 0.4rem;
  width: 100%;
  min-height: 8.75rem;
  border: 1px solid var(--line);
  padding: 0.95rem;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.guide-card:hover,
.guide-card.is-active {
  border-color: var(--green);
  background: #f8fcfa;
  color: var(--ink);
  box-shadow: 0 10px 26px rgba(16, 24, 40, 0.08);
}

.guide-card-label,
.guide-reader-meta {
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.guide-card strong {
  font-size: 1.02rem;
  line-height: 1.25;
}

.guide-card span:last-child {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.45;
}

.guide-reader {
  display: grid;
  align-content: start;
  gap: 1rem;
  min-height: 24rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.25rem;
  background: #fff;
}

.guide-reader h3 {
  margin-top: 0.25rem;
  font-size: 1.75rem;
}

.guide-reader p {
  margin-top: 0.7rem;
  font-size: 1rem;
}

.guide-reader-steps {
  display: grid;
  gap: 0.8rem;
  margin: 0;
  padding-left: 1.25rem;
}

.guide-reader-steps li {
  color: #344054;
  line-height: 1.65;
}

.guide-reader-steps li::marker {
  color: var(--green);
  font-weight: 900;
}

.article-draft-workspace {
  display: grid;
  grid-template-columns: minmax(16rem, 0.8fr) minmax(0, 1.5fr);
  gap: 1rem;
  border: 1px solid #ccebd6;
  border-radius: 8px;
  padding: 1rem;
  background: #f8fcfa;
}

.draft-list-panel,
.draft-editor {
  display: grid;
  align-content: start;
  gap: 0.85rem;
}

.draft-list-header,
.draft-editor-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.draft-list-header h3 {
  font-size: 1.1rem;
}

.draft-list-header p,
.draft-editor-footer p {
  font-size: 0.9rem;
}

.draft-article-list {
  display: grid;
  gap: 0.65rem;
}

.draft-article-item {
  display: grid;
  gap: 0.25rem;
  width: 100%;
  min-height: auto;
  border: 1px solid var(--line);
  padding: 0.7rem;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.draft-article-item:hover,
.draft-article-item.is-active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--ink);
}

.draft-article-item strong,
.draft-article-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.draft-article-body {
  min-height: 18rem;
}

button.danger {
  color: #c2410c;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 1rem;
  background: rgba(16, 24, 40, 0.48);
}

.modal.is-open {
  display: grid;
}

.modal-panel {
  width: min(36rem, 100%);
  max-height: min(44rem, calc(100vh - 2rem));
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(16, 24, 40, 0.24);
}

.modal-header,
.saved-recipes-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.modal-header {
  border-bottom: 1px solid var(--soft-line);
  padding: 1.25rem;
}

.account-form,
.saved-recipes-panel {
  display: grid;
  gap: 0.85rem;
  padding: 1.25rem;
}

.saved-recipes-panel {
  border-top: 1px solid var(--soft-line);
}

.saved-recipes-list {
  display: grid;
  gap: 0.65rem;
}

.saved-recipe-card {
  display: grid;
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem;
  background: #fff;
}

.saved-recipe-card strong {
  color: var(--ink);
}

.saved-recipe-card span {
  color: var(--muted);
  font-size: 0.85rem;
}

.saved-recipe-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

@media (max-width: 1050px) {
  .site-nav {
    display: none;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .site-header,
  .app-banner,
  .output-header,
  .guide-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-header {
    position: static;
    padding: 1rem;
  }

  .app-shell {
    width: min(100% - 1rem, 1500px);
    padding-top: 0.75rem;
  }

  .serving-grid,
  .ingredient-scale-grid,
  .url-row,
  .import-tabs,
  .rounding-toggle,
  .recipe-summary-card,
  .guide-layout,
  .article-draft-workspace {
    grid-template-columns: 1fr;
  }

  .output-actions,
  .actions {
    width: 100%;
    flex-direction: column;
  }

  .output-actions button,
  .actions button {
    width: 100%;
  }

  .guide-filters {
    justify-content: flex-start;
  }

  .guide-reader {
    min-height: auto;
  }

  .draft-list-header,
  .draft-editor-footer {
    flex-direction: column;
  }
}

@media print {
  body {
    background: #fff;
  }

  .site-header,
  .app-banner,
  .input-panel,
  .guide-panel,
  .output-actions,
  .smart-tip,
  .modal {
    display: none !important;
  }

  .app-shell {
    display: block;
    width: 100%;
    padding: 0;
  }

  .output-panel {
    border: 0;
    box-shadow: none;
  }

  .converted-table {
    min-width: 0;
  }
}
