:root {
  --bg: #FAF7F0;
  --primary: #526B4F;
  --primary-dark: #3e5340;
  --secondary: #D97752;
  --secondary-soft: rgba(217, 119, 82, 0.12);
  --text: #252525;
  --muted: #5c5c5c;
  --surface: #FFFFFF;
  --accent: #E7B94C;
  --line: #e4ddd0;
  --line-strong: #d4ccbc;
  --ok: #526B4F;
  --stop: #c45c3e;
  --shadow: 0 10px 30px rgba(37, 37, 37, 0.08);
  --sans: Inter, "Segoe UI", sans-serif;
  --display: "DM Serif Display", Georgia, serif;
  --radius: 14px;
  --btn-radius: 10px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.5;
}
img, svg { max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
h1, h2, h3 {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text);
  margin: 0 0 0.6rem;
}
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.15; }
h2 { font-size: 1.15rem; }
p { color: var(--muted); margin: 0 0 0.8rem; }
p a:not(.btn) {
  color: var(--secondary);
  font-weight: 600;
}
p a:not(.btn):hover { text-decoration: underline; }

.recipe-title,
.brand {
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: -0.02em;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  border-top: 3px solid var(--secondary);
  border-bottom: 1px solid var(--line);
  background: rgba(250, 247, 240, 0.92);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand-block {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  min-width: 0;
}
.brand {
  font-size: 1.45rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.brand-mark {
  height: 40px;
  width: auto;
  display: block;
  flex-shrink: 0;
}
.brand-center-name,
.brand-switch summary {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  text-transform: none;
  color: var(--secondary);
}
.brand-switch summary:hover {
  color: #b85d3d;
  background: var(--secondary-soft);
}
.brand-center-name {
  padding: 0.45rem 0.65rem;
  border-radius: var(--btn-radius);
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}
.brand-switch .nav-menu-panel {
  left: 0;
  right: auto;
}
.brand-switch-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 10rem;
  color: var(--secondary);
}
.brand-switch .nav-menu-kicker { display: none; }
.nav-toggle {
  display: none;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--btn-radius);
  padding: 0.45rem 0.7rem;
  min-height: 44px;
}
.site-nav { display: flex; flex-wrap: nowrap; gap: 0.15rem; align-items: center; }
.site-nav a,
.site-nav .nav-menu summary {
  color: var(--muted);
  padding: 0.45rem 0.65rem;
  border-radius: var(--btn-radius);
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  list-style: none;
}
.site-nav a:hover,
.site-nav .nav-menu summary:hover { color: var(--secondary); background: var(--secondary-soft); }
.site-nav a.is-active {
  color: #fff;
  background: var(--primary);
}
.nav-menu summary {
  padding: 0.45rem 0.65rem;
  border-radius: var(--btn-radius);
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  list-style: none;
}
.nav-menu summary::-webkit-details-marker { display: none; }
.nav-menu summary::after {
  content: "";
  width: 0.38rem;
  height: 0.38rem;
  margin-left: 0.4rem;
  margin-top: -0.15rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}
.nav-menu { position: relative; }
.nav-menu-panel {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  min-width: 13.5rem;
  padding: 0.45rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 30;
}
.nav-menu-kicker {
  display: none;
  margin: 0.15rem 0.55rem 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--secondary);
}
.nav-menu-panel a {
  display: flex;
  width: 100%;
  min-height: 40px;
}
.site-nav .nav-menu.is-current summary {
  color: var(--primary);
  font-weight: 600;
  background: transparent;
}
.nav-split {
  width: 1px;
  height: 1.15rem;
  margin: 0 0.35rem;
  background: var(--line-strong);
  flex-shrink: 0;
}
.nav-exit { color: var(--muted); }

.wrap { width: min(1120px, calc(100% - 1.5rem)); margin: 1.4rem auto 3rem; }
.page-back {
  position: sticky;
  top: 4.55rem;
  z-index: 15;
  background: var(--bg);
  margin: 0 0 0.85rem;
  padding: 0.15rem 0 0.55rem;
}
.page-back a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--secondary);
  font-weight: 600;
  font-size: 0.95rem;
}
.page-back a:hover { color: #b85d3d; }
.page-back-arrow {
  width: 0.55rem;
  height: 0.55rem;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-top: -0.05rem;
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 1rem 0 0;
}
.flow-overview { margin: 1.2rem 0 0; }
.flow-overview h2 { margin-bottom: 0.35rem; }
.flow-overview-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.flow-overview-head .kicker { margin-bottom: 0.2rem; }
.flow-phases {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}
.flow-phases li {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 0.9rem;
}
.flow-phases p { margin: 0; }
.flow-phase-n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  margin-bottom: 0.4rem;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}
.flow-slide {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.25rem 0.4rem;
  box-shadow: var(--shadow);
  margin: 1rem 0;
}
.flow-steps {
  list-style: none;
  margin: 0;
  padding: 0;
}
.flow-steps li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.9rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}
.flow-steps h3 { margin: 0 0 0.25rem; font-size: 1.05rem; }
.flow-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-family: var(--display);
  font-size: 1.2rem;
}
.flow-close { margin-top: 1rem; }
.flow-close h2 { font-family: var(--display); font-weight: 400; font-size: 1.6rem; }
.kicker {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--secondary);
  margin-bottom: 0.35rem;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 0.9rem;
}
.card, .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.05rem 1.15rem;
  box-shadow: var(--shadow);
}
.panel.formset { margin-top: 1rem; }
.formset-foot { margin: 0.85rem 0 0; }
.formset-rows {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.formset-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.95rem 0.85rem;
}
.formset-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.15rem 0.9rem;
}
.formset-field { margin: 0; }
.formset-field.is-wide { grid-column: 1 / -1; }
.formset-field .error { display: block; }
.formset-delete {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  cursor: pointer;
}
.formset-delete input {
  width: auto;
  min-height: 1.15rem;
  margin: 0;
}
.dish-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.dish-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.muted { color: var(--muted); }
.card { transition: transform 0.15s ease, border-color 0.15s ease; }
.card:hover { border-color: var(--secondary); transform: translateY(-2px); }
.week-grid { min-width: 36rem; }
.week-grid th, .week-grid td { text-align: center; }
.week-grid th:first-child,
.week-grid td:first-child { text-align: left; }
.week-cell { padding: 0.35rem 0.2rem; }
.week-cell a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
  min-height: 44px;
  font-weight: 600;
  border-radius: 8px;
}
.week-cell a:hover { background: var(--secondary-soft); color: var(--secondary); }
.week-cell span { font-size: 0.78rem; font-weight: 400; color: var(--muted); }
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}
.list li:last-child { border-bottom: 0; }
.tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: var(--btn-radius);
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--text);
}
.tag.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.tag.is-stop {
  background: var(--stop);
  color: #fff;
  border-color: var(--stop);
}
.btn,
a.btn,
button.btn,
button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: var(--primary);
  color: #fff;
  border: 0;
  padding: 0.62rem 1rem;
  min-height: 44px;
  border-radius: var(--btn-radius);
  font-weight: 600;
  cursor: pointer;
}
.btn:hover, button[type="submit"]:hover { background: var(--primary-dark); }
.btn.ghost, button.ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line-strong);
}
.btn.ghost:hover, button.ghost:hover { border-color: var(--secondary); color: var(--secondary); }
.btn.danger, button.danger { background: var(--secondary); color: #fff; }
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.messages li {
  background: var(--surface);
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  margin-bottom: 0.6rem;
}
.messages li.error { border-color: var(--secondary); color: var(--secondary); }
.subnav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin: 0 0 1rem;
}
.subnav a {
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: var(--btn-radius);
  white-space: nowrap;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}
.subnav a.is-active, .subnav a:hover {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}
.crud-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
  margin-bottom: 0.9rem;
  flex-wrap: wrap;
}
.search-form { display: flex; gap: 0.4rem; flex: 1 1 240px; }
.search-form input { max-width: 420px; }
.actions {
  display: inline-flex;
  gap: 0.35rem;
  flex-wrap: nowrap;
  justify-content: flex-end;
  vertical-align: middle;
}
.actions .btn { padding: 0.4rem 0.7rem; min-height: 38px; font-size: 0.88rem; }
.crud-table .col-actions {
  text-align: right;
  width: 1%;
  white-space: nowrap;
}
.btn.icon-btn,
a.btn.icon-btn {
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: var(--btn-radius);
}
.icon-btn.js-open-delete:hover {
  color: var(--secondary);
  border-color: var(--secondary);
}
.icon {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn[data-tooltip] { position: relative; }
.floating-tooltip {
  position: fixed;
  transform: translate(-50%, calc(-100% - 8px));
  background: var(--text);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.32rem 0.55rem;
  border-radius: 8px;
  z-index: 80;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--shadow);
}
.floating-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--text);
}
.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
body.modal-open { overflow: hidden; }
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(37, 37, 37, 0.45);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 40;
  padding: 0.75rem;
}
.modal-overlay.is-open { display: flex !important; }
.modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px 18px 12px 12px;
  width: min(560px, 100%);
  max-height: 92vh;
  overflow: auto;
  padding: 1.15rem 1.2rem 1.25rem;
  box-shadow: var(--shadow);
}
.modal-wide { width: min(760px, 100%); }
.modal-head { display: flex; justify-content: space-between; gap: 1rem; align-items: center; margin-bottom: 0.8rem; }
.modal-head h2 { margin: 0; font-size: 1.2rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; flex-wrap: wrap; }
.modal-details { margin: 0; }
.modal-details dt {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
  margin-top: 0.75rem;
}
.modal-details dt:first-child { margin-top: 0; }
.modal-details dd { margin: 0.2rem 0 0; white-space: pre-wrap; }
.modal-split {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 1rem 1.25rem;
  align-items: start;
}
.modal-split:has(.js-view-photo[hidden]) { grid-template-columns: 1fr; }
.modal-split .modal-photo {
  margin: 0;
  max-width: none;
  width: 100%;
}
.modal-ficha { width: min(820px, 100%); }
.modal-ficha .modal-split { grid-template-columns: 10.5rem 1fr; }
.ficha-view-meta .kicker { margin-bottom: 0.2rem; }
.ficha-view-meta .recipe-title {
  margin: 0 0 0.9rem;
  font-size: clamp(1.25rem, 2.4vw, 1.7rem);
  line-height: 1.2;
  color: var(--text);
}
.ficha-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  margin: 0;
}
.ficha-fact { min-width: 4.75rem; }
.ficha-facts dt {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
  margin: 0;
}
.ficha-facts dd {
  margin: 0.2rem 0 0;
  color: var(--text);
  font-weight: 600;
}
.ficha-view-block {
  margin-top: 1.15rem;
  padding-top: 1.05rem;
  border-top: 1px solid var(--line);
}
.ficha-view-block h3 {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
  margin: 0 0 0.55rem;
}
.ficha-method {
  margin: 0;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.55;
}
.ficha-method.is-empty-copy { color: var(--muted); }
.ficha-view table { margin: 0; }
.ficha-view table th {
  background: transparent;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 0.45rem 0.35rem 0.55rem 0;
}
.ficha-view table td {
  padding: 0.55rem 0.35rem 0.55rem 0;
  background: transparent;
}
.ficha-view table tbody tr:nth-child(even) td { background: transparent; }
.ficha-view table tbody td:first-child { box-shadow: none; }
.ficha-view table tbody tr:hover td { background: transparent; }
.ficha-view table tbody tr:hover td:first-child { box-shadow: none; }
label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  margin: 0.55rem 0 0.25rem;
}
input, select, textarea {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  min-height: 44px;
}
textarea { min-height: 96px; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--secondary);
  border-color: var(--secondary);
}
.panel:has(table) { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
.crud-table { min-width: 0; }
.col-thumb { width: 3.4rem; }
.thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  display: block;
}
.thumb-lg,
.modal-photo,
.record-photo {
  width: 100%;
  max-width: 220px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  display: block;
}
.modal-photo { margin: 0 0 0.85rem; }
.record-hero {
  display: flex;
  gap: 1.1rem;
  align-items: flex-start;
  flex-wrap: wrap;
  margin: 0 0 1rem;
}
.record-hero h1 { margin-bottom: 0.35rem; }
.field-image-current {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin: 0.4rem 0 0;
}
th, td { text-align: left; padding: 0.75rem 0.7rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: var(--primary);
  border-bottom-color: var(--primary);
  white-space: nowrap;
}
thead th:first-child { border-radius: 8px 0 0 0; }
thead th:last-child { border-radius: 0 8px 0 0; }
tbody tr:nth-child(even) td { background: var(--secondary-soft); }
tbody tr:hover td { background: rgba(217, 119, 82, 0.18); }
tbody td:first-child { box-shadow: inset 3px 0 0 transparent; }
tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--secondary); }
td.cell-primary { font-weight: 600; color: var(--text); }
tbody tr:has(td.is-empty) td,
tbody tr:has(td.is-empty):hover td {
  background: transparent;
  box-shadow: none;
  color: var(--muted);
}
.check-done { color: var(--muted); text-decoration: line-through; }
.check-not-done { color: var(--stop); }
.task-check {
  flex-wrap: wrap;
  align-items: flex-start;
}
.task-check-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1 1 240px;
  max-width: 420px;
}
.task-check-form textarea {
  min-height: 68px;
  width: 100%;
}
.task-check-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}
.login-box {
  width: min(420px, 100%);
  margin: 8vh auto;
  background: var(--bg);
  border-color: transparent;
  border-top: 3px solid var(--secondary);
  box-shadow:
    0 18px 44px rgba(37, 37, 37, 0.14),
    0 4px 12px rgba(37, 37, 37, 0.06);
}
.login-logo {
  display: block;
  width: min(260px, 100%);
  height: auto;
  margin: 0 auto 1.1rem;
}
.recipe-picker { margin-top: 1rem; }
.recipe-picker-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  margin: 0 0 0.9rem;
}
.recipe-picker-toolbar input[type="search"] {
  flex: 1 1 220px;
  margin: 0;
}
.recipe-picker-meal {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--muted);
}
.recipe-picker-meal select { width: auto; min-width: 10rem; margin: 0; }
.recipe-pick-accords {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: min(28rem, 60vh);
  overflow: auto;
}
.recipe-pick-group {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  padding: 0;
}
.recipe-pick-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  padding: 0.7rem 0.9rem;
  cursor: pointer;
  list-style: none;
}
.recipe-pick-head::-webkit-details-marker { display: none; }
.recipe-pick-chevron {
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--primary);
  border-bottom: 2px solid var(--primary);
  transform: rotate(-45deg);
  margin-right: 0.15rem;
  flex-shrink: 0;
}
.recipe-pick-group[open] .recipe-pick-chevron { transform: rotate(45deg); margin-top: -0.15rem; }
.recipe-pick-body { padding: 0 0.9rem 0.85rem; }
.recipe-pick-tools { margin: 0 0 0.5rem; }
.recipe-pick-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.25rem 0.7rem;
  max-height: 14rem;
  overflow: auto;
  padding-right: 0.2rem;
}
.recipe-pick-item {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  margin: 0;
  padding: 0.25rem 0;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}
.recipe-pick-item input {
  width: auto;
  min-height: 1.1rem;
  margin: 0.15rem 0 0;
}
.help { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--secondary); }
.filter-row { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; margin-bottom: 1rem; }
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
  justify-content: center;
  margin-top: 0.9rem;
}
.page-link,
.page-gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 38px;
  padding: 0 0.45rem;
  border-radius: var(--btn-radius);
  font-weight: 600;
  font-size: 0.9rem;
}
.page-link {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line-strong);
}
.page-link:hover { border-color: var(--secondary); color: var(--secondary); }
.page-link.is-current {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.page-gap {
  color: var(--muted);
  min-width: 1.2rem;
  border: 0;
  padding: 0;
}

@media (min-width: 800px) {
  .modal-overlay { align-items: center; }
  .modal { border-radius: var(--radius); }
  .modal-split { grid-template-columns: 12.5rem 1fr; }
  .modal-ficha .modal-split { grid-template-columns: 14rem 1fr; }
}

@media (max-width: 800px) {
  .wrap { width: calc(100% - 1.1rem); margin: 1rem auto 2.5rem; }
  .grid-2 { grid-template-columns: 1fr; }
  .flow-phases { grid-template-columns: 1fr; }
  .formset-card-grid { grid-template-columns: 1fr; }
  .formset-field.is-wide { grid-column: auto; }
  .nav-toggle { display: inline-flex; }
  .site-nav {
    display: none;
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0.75rem;
    left: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 0.5rem;
    box-shadow: var(--shadow);
    flex-direction: column;
    align-items: stretch;
    flex-wrap: wrap;
  }
  .topbar { position: sticky; }
  .topbar.is-open .site-nav { display: flex; }
  .site-nav a,
  .site-nav .nav-menu summary { min-height: 44px; }
  .site-nav .nav-menu { display: contents; }
  .site-nav .nav-menu summary { display: none; }
  .site-nav .nav-menu-panel {
    position: static;
    min-width: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
    display: flex;
    flex-direction: column;
  }
  .site-nav .nav-menu-kicker { display: block; }
  .nav-split {
    width: auto;
    height: 1px;
    margin: 0.45rem 0.4rem;
  }
  input, select, textarea, button, .btn { font-size: 16px; }
  .list li { flex-direction: column; align-items: flex-start; }
  .crud-toolbar, .search-form { flex-direction: column; align-items: stretch; }
  .search-form input, .crud-toolbar .btn { max-width: none; width: 100%; }
  .actions { width: auto; margin-left: auto; }
  .actions .btn { flex: 0 0 auto; }
  .actions .icon-btn { flex: 0 0 38px; width: 38px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn, .modal-actions button { width: 100%; }
  .filter-row .btn { width: 100%; }
  .export-actions .btn { width: 100%; }
  .export-actions .icon-btn { width: 38px; }
  .panel:has(table) { overflow: visible; }
  table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
  }
  table, table tbody {
    display: block;
    width: 100%;
  }
  table tr {
    display: block;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.85rem 0.95rem;
    margin-bottom: 0.75rem;
    background: var(--surface);
    box-shadow: inset 3px 0 0 var(--secondary);
  }
  table tbody tr:nth-child(even) {
    background: var(--secondary-soft);
  }
  table td {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
    width: 100%;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--line);
    white-space: normal;
    background: transparent;
    box-shadow: none;
  }
  table td:last-child { border-bottom: 0; }
  table td::before {
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--secondary);
  }
  table td:not([data-label])::before,
  table td[data-label=""]::before,
  table td.col-actions::before,
  table td.is-empty::before {
    content: none;
  }
  table td.cell-primary {
    font-weight: 600;
  }
  .crud-table td.col-actions,
  table td.col-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-end;
    align-items: center;
    width: 100%;
    max-width: 100%;
    white-space: normal;
    text-align: right;
    padding-top: 0.7rem;
  }
  .crud-table td.col-actions .actions,
  table td.col-actions .actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-end;
    width: auto;
    max-width: 100%;
  }
  table td.is-empty {
    display: block;
    text-align: center;
    color: var(--muted);
    border: 0;
    padding: 0.2rem 0;
  }
  table tr:has(td.is-empty) {
    background: transparent;
    border-style: dashed;
  }
  .ficha-view table thead {
    position: static;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    clip: auto;
    clip-path: none;
  }
  .ficha-view table,
  .ficha-view table tbody {
    display: table;
    width: 100%;
  }
  .ficha-view table tbody { display: table-row-group; }
  .ficha-view table tr {
    display: table-row;
    border: 0;
    border-radius: 0;
    padding: 0;
    margin: 0;
    background: transparent;
    box-shadow: none;
  }
  .ficha-view table td {
    display: table-cell;
    width: auto;
    padding: 0.5rem 0.4rem 0.5rem 0;
    border-bottom: 1px solid var(--line);
    white-space: normal;
  }
  .ficha-view table td::before { content: none; }
  .ficha-view table td.is-empty {
    display: table-cell;
    text-align: left;
    padding: 0.5rem 0;
  }
  .ficha-view table tr:has(td.is-empty) {
    border: 0;
    background: transparent;
  }
  .week-grid thead {
    position: static;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    clip: auto;
    clip-path: none;
  }
  .week-grid,
  .week-grid tbody {
    display: table;
    width: 100%;
  }
  .week-grid tbody { display: table-row-group; }
  .week-grid tr {
    display: table-row;
    border: 0;
    border-radius: 0;
    padding: 0;
    margin: 0;
    background: transparent;
    box-shadow: none;
  }
  .week-grid td {
    display: table-cell;
    width: auto;
    padding: 0.35rem 0.2rem;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
  }
  .week-grid td::before { content: none; }
  .week-grid td.cell-primary {
    white-space: normal;
  }
}

@media (max-width: 520px) {
  .brand span { display: none; }
  h1 { font-size: 1.6rem; }
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.avatar-lg { width: 56px; height: 56px; font-size: 1.05rem; }
.worker-strip {
  display: flex;
  gap: 0.7rem;
  overflow-x: auto;
  padding: 0.2rem 0 1rem;
  margin: 0 0 0.4rem;
}
.worker-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.85rem 0.35rem 0.35rem;
  min-width: max-content;
  box-shadow: var(--shadow);
}
.worker-chip small { display: block; color: var(--muted); font-size: 0.75rem; }
.worker-chip.is-idle { border-style: dashed; }
.job-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 1rem;
}
.job-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.05rem 1.1rem 0.95rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.job-tile.is-open { border-color: var(--secondary); border-width: 2px; }
a.job-tile { color: inherit; }
a.job-tile:hover { transform: translateY(-2px); }
.job-tile.is-selected {
  border-color: var(--primary);
  border-width: 2px;
  box-shadow: 0 0 0 3px var(--secondary-soft);
}
.job-tile-link h2 { margin-bottom: 0; }
.job-owner {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.job-missing {
  margin: 0;
  color: var(--secondary);
  font-weight: 600;
}
.job-progress {
  height: 8px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
}
.job-progress span {
  display: block;
  height: 100%;
  background: var(--primary);
}
.job-assign {
  display: flex;
  gap: 0.45rem;
  align-items: stretch;
}
.job-assign select {
  flex: 1;
  margin: 0;
  min-height: 44px;
}
.job-assign button { min-height: 44px; }
.job-tile-actions { margin: 0; }
.job-tags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.job-tags li {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: var(--btn-radius);
  background: var(--secondary-soft);
  color: var(--secondary);
}
.tag.is-warn {
  background: var(--accent);
  color: var(--text);
  border-color: var(--accent);
}
.work-job { margin: 0 0 1.4rem; }
.work-step {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.95rem 1rem;
  margin: 0.7rem 0 0;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}
.work-step.is-done { border-left-color: var(--ok); opacity: 0.88; }
.work-step.is-missing { border-left-color: var(--stop); }
.work-step.is-warn { border-left-color: var(--accent); }
.work-step h3 { margin-bottom: 0.35rem; }
.work-step .task-check-form { max-width: none; }
.work-note {
  background: var(--secondary-soft);
  border-radius: 10px;
  padding: 0.45rem 0.65rem;
  color: var(--text);
}
.job-board-compact .work-step { box-shadow: none; }
.worker-card:hover { border-color: var(--secondary); }
.work-step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}
.work-when {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}
.work-meta {
  display: grid;
  gap: 0.55rem;
  margin: 0.35rem 0 0.7rem;
}
.work-meta div { margin: 0; }
.work-meta dt {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--secondary);
  margin: 0 0 0.15rem;
}
.work-meta dd { margin: 0; }
.work-note-label { margin-top: 0; }
.work-actions-alt {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  width: 100%;
}
.work-closed {
  margin: 1.2rem 0 0;
}
.work-closed summary {
  font-weight: 600;
  cursor: pointer;
  padding: 0.75rem 0;
  color: var(--muted);
}
.work-switch { margin-top: 1.2rem; }
.work-count {
  font-weight: 600;
  color: var(--primary);
  margin: 0;
}
.photo-field { margin: 0.55rem 0 0.7rem; position: relative; }
.photo-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.photo-pick {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  margin: 0;
  padding: 0.55rem 0.85rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--btn-radius);
  background: var(--bg);
  color: var(--secondary);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}
.photo-pick:hover { border-color: var(--secondary); }
.work-photo {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 12px;
  margin-top: 0.55rem;
  border: 1px solid var(--line);
}
.photo-clear {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.45rem 0 0;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  cursor: pointer;
}
.photo-clear input { width: auto; min-height: 1.15rem; margin: 0; }
body.is-worker .photo-pick { min-height: 52px; font-size: 1rem; }

body.is-worker {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
body.is-worker .topbar {
  padding: 0.55rem 0.9rem;
}
body.is-worker .brand { font-size: 1.15rem; }
body.is-worker .brand-mark { height: 32px; }
body.is-worker .brand-center-name {
  min-height: 32px;
  padding: 0.2rem 0.45rem;
  font-size: 0.95rem;
}
body.is-worker .worker-exit {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--btn-radius);
  background: var(--surface);
  font-weight: 600;
}
body.is-worker .wrap {
  width: calc(100% - 1.2rem);
  max-width: 520px;
  margin: 0.7rem auto 2.5rem;
}
body.is-worker .work-hero {
  padding: 0 0 0.55rem;
  margin: 0 0 0.15rem;
}
body.is-worker .work-hero h1 { font-size: 1.65rem; margin-bottom: 0.25rem; }
body.is-worker .work-step {
  padding: 1rem 0.95rem 1.05rem;
  margin-top: 0.8rem;
}
body.is-worker .work-step h3 { font-size: 1.2rem; }
body.is-worker .work-step-form textarea {
  min-height: 72px;
  font-size: 16px;
}
body.is-worker .work-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  justify-content: stretch;
}
body.is-worker .work-actions button,
body.is-worker .work-actions .btn {
  width: 100%;
  min-height: 52px;
  font-size: 1.05rem;
}
body.is-worker .work-actions-alt .ghost { width: 100%; }
body.is-worker .messages li { font-size: 1rem; }

.history-people {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.history-people.is-compact { gap: 0.2rem; }
.avatar-sm { width: 28px; height: 28px; font-size: 0.65rem; }
.history-views .btn { margin-left: auto; }
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  margin: 0 0 0.85rem;
}
.cal-nav h2 { margin: 0; text-transform: capitalize; }
.cal-nav .btn { min-width: 44px; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
}
.cal-grid > span:nth-child(-n+7) {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0.2rem 0 0.35rem;
}
.cal-day {
  min-height: 72px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.4rem 0.45rem 0.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  color: inherit;
}
a.cal-day:hover { border-color: var(--secondary); }
.cal-day.is-out { opacity: 0.42; }
.cal-day.is-today { box-shadow: inset 0 0 0 2px var(--secondary); }
.cal-day.has-day.is-ok { border-left: 3px solid var(--ok); }
.cal-day.has-day.is-issue { border-left: 3px solid var(--secondary); }
.cal-num { font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-meta {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.2;
}
@media (max-width: 800px) {
  .history-views .btn { margin-left: 0; width: auto; }
  .cal-day { min-height: 58px; padding: 0.3rem; }
  .cal-meta { display: none; }
}
.history-table tr.is-ok td.cell-primary a { color: var(--primary); }
.history-table tr.is-issue td.cell-primary a { color: var(--secondary); }
.history-table tr.is-selected td { background: var(--secondary-soft); }
.history-table .month-row td,
.history-table .month-row td.is-empty {
  background: var(--bg);
  color: var(--secondary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding-top: 1rem;
}
.history-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.55rem;
}
.history-photos img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
}
.review-step {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  margin: 0.65rem 0 0;
  border-left: 4px solid var(--primary);
}
.review-step.is-done { border-left-color: var(--ok); }
.review-step.is-missing { border-left-color: var(--stop); }
.scan-review textarea { width: 100%; min-height: 3.2rem; }
.scan-review select { min-width: 8.5rem; }
.scan-crop {
  display: block;
  width: 100%;
  max-height: 72px;
  object-fit: contain;
  object-position: left center;
  margin-top: 0.4rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.history-table tr.is-marked td { opacity: 0.78; }
.review-step.is-warn { border-left-color: var(--accent); }
.review-step h3 { margin-bottom: 0.2rem; font-size: 1.05rem; }
