:root {
  --ink: #252323;
  --slate: #70798c;
  --paper: #f5f1ed;
  --linen: #dad2bc;
  --taupe: #a99985;

  --bg: #f5f1ed;
  --text: #252323;
  --muted: rgba(37, 35, 35, .68);
  --line: #252323;
  --panel: rgba(245, 241, 237, .96);
  --panel-warm: #e7dfd0;
  --panel-cool: #d9dde4;
  --accent: #70798c;
  --accent-soft: #c3cad6;
  --accent-warm: #a99985;
  --danger: #9b5148;
  --success: #637b63;

  --shadow: 0 10px 0 rgba(37, 35, 35, .14);
  --shadow-small: 4px 4px 0 rgba(37, 35, 35, .18);
  --radius: 24px;
  --radius-small: 16px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 9% 9%, rgba(218, 210, 188, .72), transparent 27%),
    radial-gradient(circle at 95% 2%, rgba(112, 121, 140, .30), transparent 30%),
    linear-gradient(180deg, var(--paper) 0%, #ece5db 56%, #d7ccbb 100%);
}

a { color: inherit; text-decoration: none; }

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

button { color: inherit; }

.top-strip {
  background: var(--ink);
  color: var(--paper);
  text-align: center;
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .08em;
  padding: .55rem;
  border-bottom: 3px solid var(--line);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .8rem clamp(1rem, 3vw, 2rem);
  background: rgba(245, 241, 237, .90);
  backdrop-filter: blur(12px);
  border-bottom: 3px solid var(--line);
}

.brand {
  display: none;
}

.brand-mark,
.brand-text {
  display: none;
}

.menu-toggle {
  display: none;
  align-items: center;
  gap: .42rem;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  padding: .55rem .85rem;
  font-weight: 950;
  cursor: pointer;
  box-shadow: var(--shadow-small);
  -webkit-appearance: none;
  appearance: none;
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 3px;
  border-radius: 99px;
  background: currentColor;
  transition: transform .16s ease, opacity .16s ease;
}

.menu-toggle strong {
  margin-left: .15rem;
  font-size: .88rem;
}

.menu-toggle.is-open span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.menu-toggle.is-open span:nth-child(2) { opacity: 0; }
.menu-toggle.is-open span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

.nav {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  margin-left: 0;
  margin-right: auto;
}

.nav a,
.userbox a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: .55rem .9rem;
  background: var(--paper);
  color: var(--ink);
  font-weight: 850;
  box-shadow: var(--shadow-small);
}

.nav a.active {
  background: var(--slate);
  color: var(--paper);
}

.userbox {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .9rem;
  font-weight: 800;
}

.userbox span { color: var(--muted); }

.main {
  width: min(1180px, calc(100% - 2rem));
  margin: 1.2rem auto 4rem;
}

.footer {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
  font-weight: 750;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding: clamp(1.4rem, 4vw, 2.5rem);
  background: var(--linen);
  border: 3px solid var(--line);
  border-radius: 34px;
  box-shadow: var(--shadow);
  margin-bottom: 1.4rem;
}

.hero.compact { padding: 1.4rem 1.6rem; }

.hero h1 {
  margin: 0;
  font-size: clamp(2.1rem, 8vw, 5.2rem);
  line-height: .82;
  text-transform: uppercase;
  letter-spacing: -.075em;
  max-width: 900px;
}

.hero.compact h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
}

.hero p {
  max-width: 620px;
  font-weight: 750;
  color: rgba(37, 35, 35, .76);
  font-size: 1.08rem;
}

.eyebrow {
  display: inline-block;
  font-size: .78rem;
  font-weight: 1000;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--slate);
  margin-bottom: .45rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  border: 3px solid var(--line);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  padding: .85rem 1.2rem;
  font-weight: 1000;
  cursor: pointer;
  box-shadow: 5px 5px 0 rgba(37, 35, 35, .22);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

.btn:hover {
  transform: translate(2px, 2px);
  box-shadow: 3px 3px 0 rgba(37, 35, 35, .22);
}

.btn.ghost {
  background: var(--paper);
  color: var(--ink);
}

.btn.small {
  padding: .55rem .8rem;
  border-width: 2px;
  box-shadow: var(--shadow-small);
}

.btn.full { width: 100%; }

.btn.copied { background: var(--success); }

.actions {
  display: flex;
  gap: .7rem;
  flex-wrap: wrap;
}

.flash {
  border: 3px solid var(--line);
  border-radius: 18px;
  background: var(--linen);
  padding: .9rem 1rem;
  margin: 1rem 0;
  font-weight: 850;
}

.flash.error {
  background: #d5a89f;
}

.duplicate-list {
  display: grid;
  gap: .65rem;
  margin-top: .65rem;
}

.duplicate-list div {
  display: grid;
  gap: .15rem;
  padding-top: .65rem;
  border-top: 2px solid rgba(37, 35, 35, .25);
}

.duplicate-list span,
.duplicate-list small {
  font-weight: 750;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.7rem;
}

.stat-card,
.panel,
.coffee-card,
.profile-card,
.recipe-card,
.login-card {
  border: 3px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 1.1rem;
  min-height: 130px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-card span {
  font-weight: 950;
  color: rgba(37, 35, 35, .66);
  text-transform: uppercase;
  font-size: .75rem;
  letter-spacing: .08em;
}

.stat-card strong {
  font-size: clamp(2.4rem, 6vw, 4.8rem);
  line-height: .8;
  letter-spacing: -.08em;
}

.stat-card.mint,
.stat-card.peach,
.stat-card.lavender,
.stat-card:nth-child(1) {
  background: var(--linen);
}

.stat-card:nth-child(2) {
  background: var(--slate);
  color: var(--paper);
}

.stat-card:nth-child(2) span {
  color: rgba(245, 241, 237, .72);
}

.stat-card:nth-child(3) {
  background: var(--taupe);
  color: var(--ink);
}

.stat-card:nth-child(3) span {
  color: rgba(37, 35, 35, .66);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin: 2rem 0 1rem;
}

.section-head h2,
.panel h2 {
  font-size: 1.55rem;
  text-transform: uppercase;
  letter-spacing: -.04em;
  margin: 0 0 .8rem;
}

.section-head a {
  font-weight: 950;
  text-decoration: underline;
  text-decoration-thickness: 3px;
}

.card-grid,
.profile-grid,
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.coffee-card,
.profile-card,
.recipe-card {
  padding: 1rem;
  position: relative;
  overflow: hidden;
}

.coffee-card:nth-child(4n+1),
.profile-card:nth-child(4n+1) {
  background: #e1d8c6;
}

.coffee-card:nth-child(4n+2),
.profile-card:nth-child(4n+2) {
  background: #c9bdad;
}

.coffee-card:nth-child(4n+3),
.profile-card:nth-child(4n+3) {
  background: #e7e4df;
}

.coffee-card:nth-child(4n+4),
.profile-card:nth-child(4n+4) {
  background: #b7ad9f;
}

.coffee-card h3,
.profile-card h3,
.recipe-card h3 {
  font-size: 1.55rem;
  line-height: .93;
  letter-spacing: -.055em;
  margin: .45rem 0 .45rem;
}

.coffee-card p,
.profile-card p,
.recipe-card p {
  font-weight: 750;
  color: rgba(37, 35, 35, .76);
}

.pill {
  display: inline-flex;
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: .25rem .55rem;
  background: rgba(245, 241, 237, .72);
  font-weight: 900;
  font-size: .78rem;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .55rem 0;
  border-top: 2px solid rgba(37, 35, 35, .16);
  font-size: .93rem;
}

.meta-row span {
  color: var(--muted);
  font-weight: 850;
}

.meta-row strong {
  text-align: right;
}

.empty {
  font-weight: 800;
  color: var(--muted);
}

.panel {
  padding: 1.2rem;
  margin-bottom: 1rem;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, .8fr);
  gap: 1rem;
  align-items: start;
}

.recipe-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.recipe-card {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  background: var(--panel-warm);
  box-shadow: 6px 6px 0 rgba(37, 35, 35, .14);
}

.recipe-card h3 {
  font-size: 1.2rem;
}

.table-wrap {
  overflow-x: auto;
  border: 3px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  text-align: left;
  padding: .9rem;
  border-bottom: 2px solid rgba(37, 35, 35, .16);
  vertical-align: top;
}

th {
  background: var(--slate);
  color: var(--paper);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

tr { cursor: default; }
tbody tr[onclick] { cursor: pointer; }

tbody tr:hover {
  background: #e9e2d5;
}

small {
  color: var(--muted);
  font-weight: 750;
}

.muted { color: var(--muted); }

.form {
  display: grid;
  gap: 1rem;
}

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

.form label,
fieldset {
  display: grid;
  gap: .35rem;
  font-weight: 900;
}

.form input,
.form select,
.form textarea {
  width: 100%;
  border: 3px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink);
  padding: .8rem .9rem;
  font-weight: 750;
  outline: none;
}

.form textarea {
  min-height: 110px;
  resize: vertical;
}

.import-prompt {
  position: relative;
  width: 100%;
  margin: 1.2rem 0;
  border: 3px solid var(--line);
  border-radius: 22px;
  background: var(--panel-warm);
  color: var(--ink);
  padding: 1.3rem 1.25rem 1.15rem;
  box-shadow: var(--shadow-small);
  overflow: hidden;
}

.import-prompt::after {
  content: "";
  position: absolute;
  width: 90px;
  height: 90px;
  right: -32px;
  bottom: -45px;
  border: 3px solid rgba(37, 35, 35, .16);
  border-radius: 50%;
  background: rgba(112, 121, 140, .16);
}

.import-prompt-label {
  display: inline-flex;
  margin-bottom: .8rem;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--slate);
  color: var(--paper);
  padding: .3rem .65rem;
  font-size: .72rem;
  font-weight: 1000;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.import-prompt pre {
  position: relative;
  z-index: 1;
  margin: 0;
  max-height: 360px;
  overflow: auto;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(.82rem, 1.4vw, .94rem);
  font-weight: 700;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.import-json-input {
  min-height: 280px !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9rem;
}

.import-divider {
  display: flex;
  align-items: center;
  gap: .8rem;
  color: var(--muted);
  font-weight: 950;
  text-transform: uppercase;
}

.import-divider::before,
.import-divider::after {
  content: "";
  height: 2px;
  flex: 1;
  background: rgba(37, 35, 35, .25);
}

.import-batch-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .7rem;
}

.form input:focus,
.form textarea:focus,
.form select:focus {
  box-shadow: 0 0 0 4px rgba(112, 121, 140, .32);
}

.full-span {
  grid-column: 1 / -1;
}

.check {
  align-content: center;
  grid-template-columns: auto 1fr;
  display: flex !important;
  align-items: center;
}

.check input { width: auto; }

fieldset {
  border: 3px dashed rgba(37, 35, 35, .35);
  border-radius: 20px;
  padding: 1rem;
}

legend {
  padding: 0 .5rem;
  font-weight: 1000;
  text-transform: uppercase;
}

.number-wheel-label {
  min-width: 0;
  align-content: start;
}

.number-wheel {
  display: block;
  width: 100%;
  border: 2px solid rgba(37, 35, 35, .28);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 5px 0 rgba(37, 35, 35, .11);
  overflow: hidden;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.number-wheel.is-open {
  border-color: rgba(37, 35, 35, .28);
  background: #f8f5f0;
  box-shadow: 0 5px 0 rgba(37, 35, 35, .11);
}

.number-wheel-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  min-width: 0;
  align-items: stretch;
}

.number-wheel-step {
  min-height: 52px;
  border: 0;
  background: var(--linen);
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 1000;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.number-wheel-step:hover { background: #cec4aa; }
.number-wheel-step:active { transform: translateY(1px); }

.number-wheel-value {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  border-inline: 1px solid rgba(37, 35, 35, .14);
  background: rgba(255, 255, 255, .42);
}

.form .number-wheel-value input {
  width: 100%;
  min-width: 0;
  max-width: none;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: .75rem .1rem;
  color: var(--ink);
  box-shadow: none;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  text-align: center;
  outline: 0;
}

.form .number-wheel-value input:focus {
  border: 0;
  box-shadow: none;
  outline: 0;
}

.number-wheel-value > span {
  position: absolute;
  right: .65rem;
  color: var(--muted);
  font-size: .84rem;
  font-weight: 500;
  pointer-events: none;
}

.number-wheel-panel {
  display: block;
  max-height: 0;
  border-top: 0 solid transparent;
  opacity: 0;
  overflow: hidden;
  transition: max-height .28s ease, opacity .18s ease, border-color .18s ease;
}

.number-wheel.is-open .number-wheel-panel {
  max-height: 290px;
  border-top-width: 1px;
  border-top-color: rgba(37, 35, 35, .15);
  opacity: 1;
}

.number-wheel-mount {
  display: grid;
  grid-template-columns: repeat(var(--wheel-groups, 1), minmax(0, 1fr));
  gap: .75rem;
  padding: .75rem;
}

.slot-group {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--slot-columns, 1), minmax(0, 1fr));
  gap: .35rem;
  min-width: 0;
  padding: 0 .35rem;
  border: 1px solid rgba(37, 35, 35, .16);
  border-radius: 15px;
  background: rgba(218, 210, 188, .28);
  overflow: hidden;
}

.slot-group-caption {
  position: absolute;
  z-index: 4;
  top: 0;
  right: 0;
  left: 0;
  height: 2.1rem;
  padding: .35rem .55rem;
  background: linear-gradient(180deg, var(--paper) 68%, rgba(244, 241, 234, 0));
  color: var(--slate);
  font-size: .63rem;
  font-weight: 1000;
  letter-spacing: .08em;
  text-align: left;
  text-transform: uppercase;
  pointer-events: none;
}

.slot-group::after {
  content: "";
  position: absolute;
  z-index: 1;
  top: 50%;
  right: .35rem;
  left: .35rem;
  height: 46px;
  border-block: 2px solid var(--slate);
  border-radius: 10px;
  background: rgba(112, 121, 140, .12);
  pointer-events: none;
  transform: translateY(-50%);
}

.slot-group[data-split="true"]::before {
  content: ",";
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 1000;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.slot-column {
  position: relative;
  z-index: 2;
  height: 210px;
  padding-block: 82px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  touch-action: pan-y;
}

.slot-column::-webkit-scrollbar { display: none; }

.slot-option {
  display: flex;
  height: 46px;
  width: 100%;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: rgba(37, 35, 35, .34);
  font-size: 1.05rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  scroll-snap-align: center;
  cursor: pointer;
  transition: color .12s ease, font-size .12s ease;
}

.slot-option.is-selected {
  color: var(--ink);
  font-size: 1.28rem;
  font-weight: 1000;
}

.number-wheel-range-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem;
  padding: .5rem;
}

.number-wheel-range-field {
  display: grid;
  min-width: 0;
  gap: .25rem;
}

.number-wheel-range-field > small {
  padding-left: .25rem;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 1000;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.number-wheel-range-field .number-wheel-row {
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  border: 1px solid rgba(37, 35, 35, .14);
  border-radius: 13px;
  overflow: hidden;
}

.number-wheel-range-field .number-wheel-step { min-height: 46px; }

.shot-abort-control {
  display: grid;
  gap: .75rem;
}

.shot-abort-toggle {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  border: 2px solid rgba(37, 35, 35, .28);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  padding: .65rem .9rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.shot-abort-toggle span {
  color: var(--muted);
  font-size: .75rem;
}

.shot-abort-control.is-aborted .shot-abort-toggle {
  border-color: #87473f;
  background: #f1ddd8;
  color: #71372f;
}

.shot-abort-control.is-aborted .shot-abort-toggle span { color: #a34d42; }

.shot-abort-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: .75rem;
  border: 2px solid rgba(135, 71, 63, .24);
  border-radius: 18px;
  background: rgba(241, 221, 216, .38);
  padding: .8rem;
}

.shot-abort-fields[hidden] { display: none; }

.optional-label {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 500;
}

.shot-stop-context {
  grid-column: 1 / -1;
  min-height: 1.1em;
}

.shot-entry.is-aborted .shot-entry-card {
  border-color: rgba(135, 71, 63, .5);
  background: linear-gradient(180deg, rgba(241, 221, 216, .52), rgba(255, 255, 255, .32));
}

.shot-aborted-badge {
  display: inline-flex;
  margin-top: .35rem;
  border-radius: 999px;
  background: #87473f;
  color: #fff8f5;
  padding: .25rem .5rem;
  font-size: .68rem;
  font-weight: 700;
}

.recipe-evidence-note {
  margin: .65rem 0 0;
  color: var(--muted);
  font-size: .78rem;
}

@media (max-width: 560px) {
  .number-wheel-mount {
    gap: .45rem;
    padding: .55rem;
  }

  .slot-group {
    gap: .15rem;
    padding-inline: .15rem;
  }

  .number-wheel-range-summary { gap: .35rem; }
  .number-wheel-range-field .number-wheel-row { grid-template-columns: 36px minmax(0, 1fr) 36px; }
  .number-wheel-range-field .number-wheel-step { font-size: 1.15rem; }
  .slot-option { font-size: .95rem; }
  .slot-option.is-selected { font-size: 1.12rem; }
}

.stages {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .4rem;
  margin: 1rem 0;
}

.stages span {
  border: 2px solid var(--line);
  border-radius: 13px;
  padding: .45rem;
  background: rgba(245, 241, 237, .66);
  font-weight: 900;
  font-size: .88rem;
  text-align: center;
}

.profile-card.inactive {
  opacity: .55;
}

.login-wrap {
  display: grid;
  place-items: center;
  min-height: 62vh;
}

.login-card {
  width: min(440px, 100%);
  padding: 1.5rem;
  background: var(--linen);
}

.login-card h1 {
  font-size: 3rem;
  line-height: .85;
  margin: .2rem 0 1rem;
  text-transform: uppercase;
  letter-spacing: -.07em;
}

.pagination {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.pagination span {
  font-weight: 950;
  padding: 0 .2rem;
}

@media (min-width: 761px) {
  .site-header .nav {
    display: flex !important;
    margin-left: 0;
    margin-right: auto;
  }
}

@media (max-width: 760px) {
  .site-header {
    align-items: center;
    flex-wrap: wrap;
  }

  .menu-toggle {
    display: inline-flex !important;
  }

  .site-header .nav {
    display: none !important;
    order: 3;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding-top: .75rem;
    padding-bottom: .15rem;
    overflow: visible;
    flex-direction: column;
    flex-wrap: nowrap;
  }

  body.menu-open .site-header .nav,
  .site-header .nav.is-open {
    display: flex !important;
  }

  .site-header .nav a {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .userbox {
    margin-left: auto;
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .stats,
  .split,
  .grid-form {
    grid-template-columns: 1fr;
  }

  .main {
    width: min(100% - 1rem, 1180px);
  }

  .pagination {
    justify-content: center;
  }
}

@media (max-width: 560px) {
  .shot-abort-fields { grid-template-columns: 1fr; }

  .pagination {
    justify-content: center;
  }
}

.form input,
.form select,
.form textarea {
  min-width: 0;
  max-width: 100%;
}

.form input[type="date"] {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  -webkit-appearance: none;
  appearance: none;
}

.form input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
}

/* Structured-inspired visual system */
:root {
  --hairline: rgba(37, 35, 35, .16);
  --glass: rgba(245, 241, 237, .82);
  --espresso: #3f5264;
  --milk: #a77d69;
  --long: #657c69;
  --soft-shadow: 0 14px 36px rgba(37, 35, 35, .09);
}

body {
  background:
    radial-gradient(circle at 4% 0%, rgba(218, 210, 188, .58), transparent 28%),
    radial-gradient(circle at 98% 0%, rgba(112, 121, 140, .18), transparent 25%),
    linear-gradient(180deg, #f8f5f1 0%, var(--paper) 58%, #ebe4da 100%);
}

.top-strip {
  border-bottom: 0;
  padding: .45rem;
  font-size: .68rem;
  letter-spacing: .13em;
}

.site-header {
  top: .7rem;
  width: min(1180px, calc(100% - 2rem));
  margin: .7rem auto 0;
  padding: .65rem;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 999px;
  background: var(--glass);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(22px) saturate(130%);
  -webkit-backdrop-filter: blur(22px) saturate(130%);
}

.nav a,
.userbox a {
  border: 0;
  box-shadow: none;
  background: transparent;
  padding: .65rem 1rem;
}

.nav a.active {
  background: var(--ink);
  color: var(--paper);
}

.main { margin-top: 1.8rem; }

.hero {
  padding: clamp(1.7rem, 5vw, 3.2rem);
  border: 1px solid var(--hairline);
  border-radius: 34px;
  background: rgba(231, 223, 208, .82);
  box-shadow: var(--soft-shadow);
}

.hero h1 {
  text-transform: none;
  line-height: .92;
  letter-spacing: -.065em;
}

.hero.compact h1 { font-size: clamp(2.3rem, 6vw, 4.4rem); }
.hero p { margin-bottom: 0; }

.entity-hero {
  background:
    radial-gradient(circle at 92% 15%, rgba(112, 121, 140, .22), transparent 32%),
    rgba(231, 223, 208, .82);
}

.back-link {
  display: block;
  margin-bottom: 1rem;
  color: var(--muted);
  font-weight: 900;
}

.btn {
  border: 1px solid var(--ink);
  box-shadow: none;
  transition: transform .14s ease, background .14s ease, color .14s ease;
}

.btn:hover { transform: translateY(-1px); box-shadow: none; }
.btn.ghost { border-color: var(--hairline); }
.btn.danger { color: var(--danger); }

.stat-card,
.panel,
.coffee-card,
.profile-card,
.recipe-card,
.login-card,
.table-wrap {
  border: 1px solid var(--hairline);
  box-shadow: var(--soft-shadow);
}

.stat-card { min-height: 112px; }
.stat-card strong { font-size: clamp(2.8rem, 6vw, 4.4rem); }

.section-head { align-items: center; }
.section-head h2,
.panel h2 {
  text-transform: none;
  letter-spacing: -.045em;
  font-size: clamp(1.55rem, 3vw, 2rem);
}

.section-head a {
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

.section-kicker,
.card-kicker {
  display: block;
  color: var(--slate);
  font-size: .72rem;
  font-weight: 1000;
  letter-spacing: .11em;
  text-transform: uppercase;
  margin-bottom: .35rem;
}

.card-kicker { margin-top: .9rem; }

.coffee-card,
.profile-card,
.recipe-card { padding: 1.25rem; }

.coffee-card h3,
.profile-card h3,
.recipe-card h3 {
  line-height: 1;
  letter-spacing: -.045em;
}

.active-batch-card {
  display: flex;
  flex-direction: column;
  min-height: 300px;
}

.active-batch-card .actions { margin-top: auto; padding-top: 1rem; }

.pill {
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, .56);
}

.status-pill { margin-top: .9rem; }

.panel { padding: clamp(1.15rem, 3vw, 1.7rem); }
.recipe-panel { background: rgba(255, 255, 255, .48); }

.data-quality-panel { padding-block: 1rem; }
.data-quality-panel summary {
  cursor: pointer;
  font-weight: 900;
}
.data-quality-panel ul {
  display: grid;
  gap: .65rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}
.data-quality-panel li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: .65rem;
  border-top: 1px solid var(--hairline);
}
.data-quality-panel a { font-weight: 850; }

.recipe-card {
  background: rgba(255, 255, 255, .68);
  box-shadow: none;
  min-height: 310px;
}

.recipe-card > div { width: 100%; }

.recipe-hero-value {
  margin: 1.2rem 0 1.35rem;
  padding: 1rem 0 1.2rem;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}

.recipe-hero-value span {
  display: block;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.recipe-hero-value strong {
  display: block;
  font-size: clamp(3.2rem, 8vw, 5.1rem);
  line-height: .9;
  letter-spacing: -.08em;
  margin-top: .3rem;
}

.recipe-metrics,
.shot-metrics { margin: 0; }

.recipe-metrics div,
.shot-metrics div,
.profile-facts div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .5rem 0;
  border-top: 1px solid var(--hairline);
}

.recipe-metrics dt,
.shot-metrics dt,
.profile-facts span { color: var(--muted); font-weight: 800; }

.recipe-metrics dd,
.shot-metrics dd { margin: 0; text-align: right; font-weight: 900; }

.table-wrap { border-radius: 22px; }
th { background: var(--ink); }
th, td { border-bottom-width: 1px; }

.mobile-coffee-list,
.shot-timeline { display: none; }

.profile-card { background: rgba(255, 255, 255, .7) !important; }
.profile-card-head { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }

.profile-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .7rem;
  margin: 1rem 0;
}

.profile-facts div { display: grid; gap: .2rem; }

.stages {
  position: relative;
  grid-template-columns: repeat(4, 1fr);
  gap: .55rem;
}

.stages::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 4%;
  right: 4%;
  height: 2px;
  background: var(--accent-soft);
}

.stages span {
  position: relative;
  display: grid;
  gap: .1rem;
  border: 1px solid var(--hairline);
  background: var(--paper);
  z-index: 1;
}

.stages span small { font-size: .66rem; text-transform: uppercase; }
.stages span strong { font-size: .88rem; }
.stages span em { font-style: normal; color: var(--muted); font-size: .8rem; }

.form { gap: 1.15rem; }

.form input,
.form select,
.form textarea {
  border: 1px solid rgba(37, 35, 35, .24);
  background: rgba(255, 255, 255, .68);
  min-height: 48px;
}

.form input:focus,
.form textarea:focus,
.form select:focus {
  border-color: var(--slate);
  box-shadow: 0 0 0 4px rgba(112, 121, 140, .16);
}

fieldset {
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, .3);
  padding: 1.2rem;
}

.form-section-heading {
  display: flex;
  align-items: center;
  gap: .8rem;
  margin-top: .5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--hairline);
}

.form-section-heading > span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--slate);
  color: var(--paper);
  font-size: .72rem;
  font-weight: 1000;
}

.form-section-heading div { display: grid; }
.form-section-heading strong { font-size: 1.15rem; }
.form-section-heading small { margin-top: .1rem; }

.mobile-tabbar { display: none; }

@media (max-width: 760px) {
  body { padding-bottom: 6.5rem; }
  .top-strip { display: none; }

  .site-header {
    position: relative;
    top: 0;
    width: calc(100% - 1rem);
    margin: .5rem auto 0;
    border-radius: 18px;
    justify-content: flex-end;
    background: rgba(245, 241, 237, .68);
  }

  .menu-toggle,
  .site-header .nav { display: none !important; }
  .userbox span { display: none; }
  .userbox a { padding: .45rem .7rem; font-size: .78rem; }

  .mobile-tabbar {
    position: fixed;
    z-index: 100;
    left: .55rem;
    right: .55rem;
    bottom: max(.55rem, env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(4, 1fr) auto;
    align-items: center;
    gap: .15rem;
    padding: .42rem;
    border: 1px solid rgba(255, 255, 255, .8);
    border-radius: 25px;
    background: rgba(245, 241, 237, .84);
    box-shadow: 0 12px 34px rgba(37, 35, 35, .2);
    backdrop-filter: blur(22px) saturate(145%);
    -webkit-backdrop-filter: blur(22px) saturate(145%);
  }

  .mobile-tabbar a {
    display: grid;
    justify-items: center;
    gap: .1rem;
    min-width: 0;
    padding: .35rem .18rem;
    border-radius: 16px;
    color: var(--muted);
  }

  .mobile-tabbar a.active { color: var(--ink); background: rgba(218, 210, 188, .62); }
  .mobile-tabbar a > span { font-size: 1.25rem; line-height: 1; font-weight: 1000; }
  .mobile-tabbar small { font-size: .58rem; font-weight: 900; }

  .mobile-tabbar .mobile-quick-action {
    width: 54px;
    height: 54px;
    margin-left: .2rem;
    border-radius: 50%;
    background: var(--ink);
    color: var(--paper);
  }

  .mobile-tabbar .mobile-quick-action span { font-size: 1.75rem; font-weight: 500; }
  .mobile-tabbar .mobile-quick-action small { display: none; }

  .main { margin-top: .75rem; margin-bottom: 2rem; }
  .footer { display: none; }

  .hero,
  .hero.compact { padding: 1.45rem; border-radius: 26px; }
  .hero h1,
  .hero.compact h1 { font-size: clamp(2.35rem, 12vw, 3.7rem); }

  .dashboard-hero .btn { width: 100%; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: .45rem; }
  .stat-card { min-height: 86px; padding: .75rem; border-radius: 18px; }
  .stat-card strong { font-size: 2.25rem; }
  .stat-card span { font-size: .6rem; }

  .section-head { align-items: end; margin-top: 1.7rem; }
  .section-head h2 { margin-bottom: 0; }

  .card-grid,
  .profile-grid,
  .recipe-grid { grid-template-columns: 1fr; }

  .active-batch-card { min-height: 0; }
  .active-batch-card .actions .btn:first-child { flex: 1 1 100%; }

  .table-wrap { display: none; }
  .desktop-shot-table { display: none; }

  .mobile-coffee-list {
    display: grid;
    gap: .75rem;
  }

  .mobile-coffee-card {
    display: grid;
    gap: .5rem;
    padding: 1.1rem;
    border: 1px solid var(--hairline);
    border-radius: 20px;
    background: rgba(255, 255, 255, .7);
    box-shadow: var(--soft-shadow);
  }

  .mobile-coffee-card h3 { margin: .15rem 0; font-size: 1.35rem; letter-spacing: -.035em; }
  .mobile-coffee-card p { margin: 0; color: var(--muted); font-weight: 750; }
  .mobile-coffee-meta { display: flex; justify-content: space-between; border-top: 1px solid var(--hairline); padding-top: .65rem; }
  .mobile-coffee-meta span { color: var(--muted); }
  .archived .mobile-coffee-card { opacity: .72; }

  .shot-timeline {
    display: grid;
    margin-top: .4rem;
  }

  .shot-entry {
    position: relative;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: .65rem;
    padding-bottom: 1rem;
  }

  .shot-entry:not(:last-child)::before {
    content: "";
    position: absolute;
    left: 21px;
    top: 42px;
    bottom: -2px;
    width: 2px;
    border-radius: 99px;
    background: var(--accent-soft);
  }

  .shot-marker {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--espresso);
    color: white;
    box-shadow: 0 0 0 5px var(--bg);
  }

  .use-case-cappuccino .shot-marker,
  .use-case-flat-white .shot-marker { background: var(--milk); }
  .use-case-americano .shot-marker { background: var(--long); }
  .shot-marker span { font-size: .72rem; font-weight: 1000; }

  .shot-entry-card {
    min-width: 0;
    padding: 1rem;
    border: 1px solid var(--hairline);
    border-radius: 22px;
    background: rgba(255, 255, 255, .74);
    box-shadow: var(--soft-shadow);
  }

  .shot-entry-head { display: flex; justify-content: space-between; align-items: start; gap: .7rem; }
  .shot-entry-head h3 { margin: .15rem 0 .05rem; font-size: 1.15rem; }
  .shot-date { color: var(--muted); font-size: .7rem; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; }
  .use-case-pill { padding: .28rem .5rem; border-radius: 99px; background: var(--accent-soft); font-size: .68rem; font-weight: 900; white-space: nowrap; }

  .shot-primary {
    display: grid;
    grid-template-columns: .8fr 1.2fr;
    gap: .6rem;
    margin: 1rem 0;
  }

  .shot-primary div { padding: .75rem; border-radius: 15px; background: var(--panel-warm); }
  .shot-primary span { display: block; color: var(--muted); font-size: .65rem; font-weight: 900; text-transform: uppercase; }
  .shot-primary strong { display: block; margin-top: .2rem; font-size: 1.18rem; }

  .shot-metrics { display: grid; grid-template-columns: 1fr 1fr; column-gap: 1rem; }
  .shot-metrics div { display: grid; gap: .1rem; }
  .shot-metrics dd { text-align: left; }

  .tag-list { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .8rem; }
  .tag-list span { padding: .3rem .55rem; border-radius: 99px; background: var(--linen); font-size: .7rem; font-weight: 850; }
  .shot-note { padding: .7rem; border-left: 3px solid var(--taupe); background: rgba(218, 210, 188, .32); font-weight: 700; }
  .shot-actions { border-top: 1px solid var(--hairline); padding-top: .8rem; margin-top: .8rem; }

  .recipe-card { min-height: 0; }
  .recipe-card .copy-btn { flex: 0 0 auto; }
  .recipe-hero-value strong { font-size: 4rem; }

  .profile-facts { grid-template-columns: repeat(3, 1fr); gap: .35rem; }
  .profile-facts div { padding: .55rem .15rem; }
  .profile-facts span { font-size: .65rem; }
  .stages { grid-template-columns: repeat(4, 1fr); gap: .25rem; }
  .stages span { padding: .35rem .15rem; }

  .form-section-heading { margin-top: .25rem; }
  fieldset { padding: .9rem; }
}

@media (max-width: 390px) {
  .mobile-tabbar small { font-size: .52rem; }
  .mobile-tabbar .mobile-quick-action { width: 48px; height: 48px; }
  .shot-metrics { grid-template-columns: 1fr; }
  .profile-facts { grid-template-columns: 1fr; }
}
