:root {
  --ink: #173f2d;
  --ink-soft: #4d6559;
  --leaf: #2f7d4d;
  --leaf-bright: #55a66d;
  --leaf-pale: #eaf4e9;
  --peach: #eaa05d;
  --peach-pale: #fff1df;
  --paper: #fffdf8;
  --canvas: #f4f2e9;
  --line: #dddcd2;
  --danger: #a83c32;
  --shadow: 0 14px 38px rgba(28, 62, 43, 0.08);
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 92% 0, rgba(234, 160, 93, 0.12), transparent 28rem),
    var(--canvas);
  color: var(--ink);
  line-height: 1.5;
}

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

button,
input,
select {
  font: inherit;
}

button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}

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

h1 {
  margin-bottom: 0.45rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.25rem, 7vw, 4.6rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

h2 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.05;
}

.eyebrow {
  margin-bottom: 0.55rem;
  color: var(--leaf);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 74px;
  padding: 0.75rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid rgba(221, 220, 210, 0.85);
  background: rgba(255, 253, 248, 0.88);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark,
.login-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 14px 14px 14px 4px;
  background: var(--ink);
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
  box-shadow: 0 8px 20px rgba(23, 63, 45, 0.18);
}

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

.brand strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.1;
}

.brand small {
  margin-top: 0.15rem;
  color: var(--ink-soft);
  font-size: 0.7rem;
}

.desktop-nav {
  display: none;
  align-items: center;
  gap: 0.4rem;
}

.desktop-nav a {
  padding: 0.65rem 0.95rem;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 650;
}

.desktop-nav a:hover,
.desktop-nav a.active {
  background: var(--leaf-pale);
  color: var(--ink);
}

.desktop-nav .nav-add {
  margin-left: 0.35rem;
  background: var(--ink);
  color: #fff;
}

.desktop-nav .nav-add:hover {
  background: var(--leaf);
  color: #fff;
}

.profile-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--peach-pale);
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
}

.profile-button:hover,
.profile-button.active {
  background: var(--peach);
}

.page-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(2.25rem, 6vw, 5.5rem) 0 7rem;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2.2rem;
}

.hero > div > p:last-child,
.form-intro > p:last-child {
  max-width: 560px;
  margin-bottom: 0;
  color: var(--ink-soft);
}

.hero-action {
  display: none;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0.8rem 1.25rem;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 750;
  line-height: 1;
  transition: transform 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.primary-button {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 10px 24px rgba(23, 63, 45, 0.18);
}

.primary-button:hover {
  background: var(--leaf);
  transform: translateY(-1px);
}

.primary-button span {
  margin-right: 0.5rem;
  font-size: 1.2rem;
}

.secondary-button {
  border-color: var(--line);
  background: var(--paper);
  color: var(--ink);
}

.secondary-button:hover {
  border-color: var(--leaf);
  background: var(--leaf-pale);
}

.wide {
  width: 100%;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat-card {
  min-height: 132px;
  padding: 1.15rem;
  border: 1px solid rgba(221, 220, 210, 0.85);
  border-radius: var(--radius-md);
  background: rgba(255, 253, 248, 0.78);
}

.stat-card span,
.stat-card small,
.list-summary span {
  display: block;
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.stat-card strong {
  display: block;
  margin: 0.35rem 0 0.2rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.55rem, 5vw, 2.35rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.stat-card.stat-primary {
  border-color: transparent;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
}

.stat-card.stat-primary span,
.stat-card.stat-primary small {
  color: rgba(255, 255, 255, 0.68);
}

.panel {
  padding: clamp(1.15rem, 3vw, 1.7rem);
  border: 1px solid rgba(221, 220, 210, 0.9);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.dashboard-grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.panel-heading .eyebrow {
  margin-bottom: 0.35rem;
}

.text-link {
  flex: 0 0 auto;
  color: var(--leaf);
  font-size: 0.85rem;
  font-weight: 750;
}

.mode-grid {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.mode-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.85rem;
  min-height: 82px;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
  transition: border-color 140ms ease, transform 140ms ease;
}

.mode-card:hover {
  border-color: var(--leaf);
  transform: translateY(-1px);
}

.mode-card.market-mode {
  border-color: transparent;
  background: var(--leaf);
  color: #fff;
}

.mode-card strong,
.mode-card small {
  display: block;
}

.mode-card small {
  margin-top: 0.12rem;
  color: var(--ink-soft);
  font-size: 0.7rem;
}

.mode-card.market-mode small {
  color: rgba(255, 255, 255, 0.7);
}

.mode-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 1.35rem;
}

.mode-icon.archive {
  background: var(--peach-pale);
  color: #9d5a24;
}

.mode-icon.products {
  background: var(--leaf-pale);
  color: var(--leaf);
}

.mode-arrow {
  color: currentColor;
  opacity: 0.55;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(14, minmax(11px, 1fr));
  align-items: end;
  gap: clamp(0.18rem, 1vw, 0.5rem);
  height: 225px;
  overflow: hidden;
}

.bar-column {
  display: grid;
  grid-template-rows: 1.25rem 1fr 1.35rem;
  gap: 0.25rem;
  min-width: 0;
  height: 100%;
  text-align: center;
}

.bar-value {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 0.56rem;
  text-overflow: clip;
}

.bar-track {
  position: relative;
  overflow: hidden;
  border-radius: 7px 7px 2px 2px;
  background: var(--leaf-pale);
}

.bar-fill {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  min-height: 5px;
  border-radius: 7px 7px 2px 2px;
  background: linear-gradient(180deg, var(--leaf-bright), var(--leaf));
}

.bar-column time {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 0.58rem;
}

.product-bars {
  display: grid;
  gap: 1rem;
}

.product-label {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.38rem;
  font-size: 0.82rem;
}

.product-label span {
  color: var(--ink-soft);
}

.product-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--leaf-pale);
}

.product-fill {
  height: 100%;
  min-width: 8px;
  border-radius: inherit;
  background: var(--leaf);
}

.product-fill.fruit {
  background: var(--peach);
}

.payment-panel {
  margin-bottom: 1rem;
}

.payment-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
}

.payment-total {
  padding: 1rem;
  border-radius: var(--radius-md);
  background: var(--leaf-pale);
}

.payment-total.card {
  background: #eaf0f8;
}

.payment-total.unspecified {
  background: #efeee8;
}

.payment-total span,
.payment-total small,
.payment-total strong {
  display: block;
}

.payment-total span,
.payment-total small {
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.payment-total strong {
  margin: 0.25rem 0 0.15rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.35rem, 5vw, 2rem);
  font-weight: 500;
}

.payment-ratio {
  display: flex;
  height: 12px;
  margin-top: 1rem;
  overflow: hidden;
  border-radius: 999px;
  background: #efeee8;
}

.payment-ratio > div {
  height: 100%;
  min-width: 0;
}

.payment-ratio .cash {
  background: var(--leaf);
}

.payment-ratio .card {
  background: #7392b6;
}

.payment-ratio .unspecified {
  background: #c8c6bc;
}

.payment-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.55rem;
  color: var(--ink-soft);
  font-size: 0.7rem;
}

.payment-legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 0.25rem;
  border-radius: 50%;
  background: var(--leaf);
}

.payment-legend i.card {
  background: #7392b6;
}

.payment-legend i.unspecified {
  background: #c8c6bc;
}

.recent-panel {
  padding-bottom: 0.45rem;
}

.sale-list {
  display: grid;
}

.sale-row {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 0;
  border-top: 1px solid var(--line);
}

.produce-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--leaf);
  box-shadow: 0 0 0 4px var(--leaf-pale);
}

.produce-dot.fruit {
  background: var(--peach);
  box-shadow: 0 0 0 4px var(--peach-pale);
}

.sale-product strong,
.sale-product time,
.sale-price strong,
.sale-price small {
  display: block;
}

.sale-product time,
.sale-price small {
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.sale-weight {
  display: none;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.sale-price {
  text-align: right;
}

.empty-state {
  display: grid;
  justify-items: center;
  padding: 3rem 1rem;
  text-align: center;
}

.empty-state > span {
  margin-bottom: 0.75rem;
  font-size: 2rem;
}

.empty-state h3 {
  margin-bottom: 0.4rem;
}

.empty-state p {
  max-width: 360px;
  margin-bottom: 1.25rem;
  color: var(--ink-soft);
}

.empty-state.compact {
  padding: 2rem 0.5rem;
}

.empty-state.compact p {
  margin-bottom: 0;
}

.form-page {
  display: grid;
  gap: 1.7rem;
  max-width: 920px;
  margin: 0 auto;
}

.form-intro h1 {
  max-width: 650px;
}

.back-link {
  display: inline-block;
  margin-bottom: 1.75rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 700;
}

.sale-form {
  padding: clamp(1.25rem, 5vw, 2.5rem);
}

.form-grid {
  display: grid;
  gap: 1.1rem;
}

.field,
.filter-field {
  display: grid;
  min-width: 0;
  gap: 0.42rem;
}

.field label,
.filter-field label {
  font-size: 0.78rem;
  font-weight: 800;
}

.optional {
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 500;
}

.field input,
.field select,
.filter-field input,
.filter-field select,
.login-form input {
  width: 100%;
  min-height: 52px;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  background: #fff;
  color: var(--ink);
  transition: border 140ms ease, box-shadow 140ms ease;
}

.field input:focus,
.field select:focus,
.filter-field input:focus,
.filter-field select:focus,
.login-form input:focus {
  border-color: var(--leaf);
  box-shadow: 0 0 0 4px rgba(47, 125, 77, 0.12);
}

.date-input,
.datetime-input {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  inline-size: 100%;
  min-inline-size: 0;
  max-inline-size: 100%;
}

.input-suffix {
  position: relative;
}

.input-suffix input {
  padding-right: 3.4rem;
  font-size: 1.2rem;
  font-weight: 750;
}

.input-suffix > span {
  position: absolute;
  top: 50%;
  right: 1rem;
  color: var(--ink-soft);
  font-weight: 700;
  transform: translateY(-50%);
}

.price-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--leaf-pale);
}

.price-preview span {
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.price-preview strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
  font-weight: 600;
}

.form-actions {
  display: grid;
  gap: 0.65rem;
  margin-top: 1.5rem;
}

.payment-actions {
  display: grid;
  gap: 0.7rem;
  margin-top: 1.5rem;
}

.sold-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-height: 58px;
  padding: 0.9rem 1rem;
  border: 0;
  border-radius: 17px;
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  transition: filter 140ms ease, transform 140ms ease, opacity 140ms ease;
}

.sold-button:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.sold-button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
  transform: none;
}

.sold-button.cash {
  background: var(--leaf);
}

.sold-button.card {
  background: #486d99;
}

.sold-button span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  font-size: 1rem;
}

.field-help {
  width: fit-content;
  color: var(--leaf);
  font-size: 0.7rem;
  font-weight: 700;
}

.form-error,
.field-error {
  color: var(--danger);
  font-size: 0.78rem;
}

.form-error {
  margin-bottom: 1rem;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background: #fff0ee;
}

.messages {
  position: fixed;
  z-index: 50;
  top: 82px;
  right: 1rem;
  left: 1rem;
  display: grid;
  justify-items: center;
  pointer-events: none;
}

.message {
  width: min(100%, 520px);
  padding: 0.85rem 1rem;
  border: 1px solid #c9dfc9;
  border-radius: 999px;
  background: #f0faef;
  box-shadow: var(--shadow);
  color: var(--ink);
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
}

.filters {
  display: grid;
  gap: 0.8rem;
  margin-bottom: 1rem;
  padding: 1rem;
}

.filter-button {
  width: 100%;
}

.reset-link {
  align-self: center;
  padding: 0.5rem;
  color: var(--ink-soft);
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
}

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

.list-summary > div {
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--leaf-pale);
}

.list-summary > div.cash {
  background: var(--leaf-pale);
}

.list-summary > div.card {
  background: #eaf0f8;
}

.list-summary strong {
  display: block;
  margin-top: 0.25rem;
  font-size: clamp(0.86rem, 3.4vw, 1.2rem);
}

.sales-table-panel {
  padding: 0.35rem 1rem;
}

.sales-table {
  width: 100%;
  border-collapse: collapse;
}

.sales-table thead {
  display: none;
}

.sales-table tbody,
.sales-table tr,
.sales-table td {
  display: block;
}

.sales-table tr {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  padding: 1rem 2rem 1rem 0;
  border-bottom: 1px solid var(--line);
}

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

.sales-table td {
  min-width: 0;
  font-size: 0.84rem;
}

.sales-table td::before {
  display: block;
  margin-bottom: 0.15rem;
  color: var(--ink-soft);
  content: attr(data-label);
  font-size: 0.64rem;
}

.sales-table td small {
  display: block;
  overflow: hidden;
  max-width: 220px;
  color: var(--ink-soft);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-product {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.table-product .produce-dot {
  flex: 0 0 auto;
}

.sales-table .action-cell {
  position: absolute;
  top: 0.7rem;
  right: 0;
}

.sales-table .action-cell::before {
  display: none;
}

.delete-button {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 1.35rem;
}

.delete-button:hover {
  background: #fff0ee;
  color: var(--danger);
}

.payment-badge {
  display: inline-flex;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: #efeee8;
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 750;
  white-space: nowrap;
}

.payment-badge.cash {
  background: var(--leaf-pale);
  color: var(--leaf);
}

.payment-badge.card {
  background: #eaf0f8;
  color: #3e628d;
}

.mobile-nav {
  position: fixed;
  z-index: 30;
  right: 0.75rem;
  bottom: max(0.75rem, env(safe-area-inset-bottom));
  left: 0.75rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 0.45rem;
  border: 1px solid rgba(221, 220, 210, 0.8);
  border-radius: 22px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 16px 44px rgba(23, 63, 45, 0.18);
  backdrop-filter: blur(18px);
}

.market-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.6rem;
}

.market-hero > div:first-child > p:last-child {
  max-width: 600px;
  margin-bottom: 0;
  color: var(--ink-soft);
}

.market-today {
  flex: 0 0 auto;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  background: var(--ink);
  color: #fff;
  text-align: right;
}

.market-today span,
.market-today small,
.market-today strong {
  display: block;
}

.market-today span,
.market-today small {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.68rem;
}

.market-today strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
  font-weight: 500;
}

.market-layout {
  display: grid;
  gap: 1rem;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.market-products {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.market-product {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.45rem 0.7rem;
  min-height: 82px;
  padding: 0.9rem;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  box-shadow: 0 7px 20px rgba(23, 63, 45, 0.06);
}

.market-product strong,
.market-product small {
  display: block;
  min-width: 0;
}

.market-product small {
  grid-column: 2;
  color: var(--ink-soft);
  font-size: 0.64rem;
}

.market-product.selected {
  border-color: var(--leaf);
  background: var(--leaf-pale);
}

.market-product.fruit.selected {
  border-color: var(--peach);
  background: var(--peach-pale);
}

.market-form {
  align-self: start;
}

.market-selection {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.market-selection span {
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.market-selection strong {
  text-align: right;
}

.market-inputs {
  display: grid;
  gap: 0.85rem;
}

.market-input input {
  min-height: 68px;
  font-size: 1.65rem;
}

.weight-stepper,
.amount-stepper {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) 62px;
  align-items: stretch;
  gap: 0.55rem;
}

.weight-stepper .market-input input,
.amount-stepper .market-input input {
  height: 100%;
  padding-right: 2.6rem;
  padding-left: 0.5rem;
  text-align: center;
}

.weight-step-button,
.amount-step-button {
  min-height: 68px;
  padding: 0;
  border: 1px solid #bcd7c2;
  border-radius: var(--radius-sm);
  background: var(--leaf-pale);
  color: var(--leaf);
  cursor: pointer;
  font-size: 2rem;
  font-weight: 500;
  line-height: 1;
  touch-action: manipulation;
}

.weight-step-button.plus,
.amount-step-button.plus {
  border-color: var(--leaf);
  background: var(--leaf);
  color: #fff;
}

.weight-step-button:active,
.amount-step-button:active {
  transform: scale(0.96);
}

.weight-step-button:disabled,
.amount-step-button:disabled {
  cursor: default;
  opacity: 0.4;
  transform: none;
}

.market-payments {
  margin-top: 1rem;
}

.market-empty {
  min-height: 360px;
}

.product-layout,
.product-groups {
  display: grid;
  gap: 1rem;
}

.product-create-form {
  display: grid;
  align-content: start;
  gap: 1rem;
}

.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--leaf-pale);
  cursor: pointer;
}

.checkbox-field input {
  width: 20px;
  height: 20px;
  margin: 0.1rem 0 0;
  accent-color: var(--leaf);
}

.checkbox-field strong,
.checkbox-field small {
  display: block;
}

.checkbox-field small {
  margin-top: 0.1rem;
  color: var(--ink-soft);
  font-size: 0.68rem;
}

.group-count {
  display: grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--leaf-pale);
  color: var(--leaf);
  font-weight: 800;
}

.group-count.fruit {
  background: var(--peach-pale);
  color: #a25c28;
}

.managed-products {
  display: grid;
}

.managed-product {
  display: grid;
  grid-template-columns: auto minmax(100px, 1fr);
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
}

.managed-product > div:nth-child(2) strong,
.managed-product > div:nth-child(2) small {
  display: block;
}

.managed-product > div:nth-child(2) small {
  color: var(--ink-soft);
  font-size: 0.68rem;
}

.managed-product.inactive {
  opacity: 0.55;
}

.product-actions {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.market-toggle,
.visibility-toggle {
  min-height: 32px;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.66rem;
  font-weight: 750;
}

.market-toggle.active {
  border-color: var(--leaf);
  background: var(--leaf-pale);
  color: var(--leaf);
}

.visibility-toggle:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.mobile-nav a {
  display: grid;
  place-items: center;
  gap: 0.1rem;
  min-height: 52px;
  border-radius: 16px;
  color: var(--ink-soft);
  font-size: 0.64rem;
  font-weight: 800;
}

.mobile-nav a > span {
  font-size: 1.25rem;
  line-height: 1;
}

.mobile-nav a.active {
  background: var(--leaf-pale);
  color: var(--ink);
}

.mobile-nav .mobile-add {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
}

.auth-body {
  display: grid;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 10%, rgba(85, 166, 109, 0.2), transparent 30rem),
    radial-gradient(circle at 90% 90%, rgba(234, 160, 93, 0.2), transparent 32rem),
    var(--canvas);
}

.auth-shell {
  display: grid;
  place-items: center;
  width: 100%;
  padding: 1.25rem;
}

.login-card {
  display: grid;
  width: min(100%, 880px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--paper);
  box-shadow: 0 28px 80px rgba(23, 63, 45, 0.13);
}

.login-brand,
.login-form {
  padding: clamp(1.8rem, 7vw, 4rem);
}

.login-brand {
  background: var(--ink);
  color: #fff;
}

.login-brand .login-mark {
  margin-bottom: 4rem;
  background: var(--peach);
  color: var(--ink);
}

.login-brand .eyebrow {
  color: #a8d6b3;
}

.login-brand h1 {
  font-size: clamp(2.75rem, 10vw, 4.5rem);
}

.login-brand p:last-child {
  max-width: 360px;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.65);
}

.login-form {
  display: grid;
  align-content: center;
  gap: 1rem;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink-soft);
  font-size: 0.7rem;
}

.auth-divider::before,
.auth-divider::after {
  height: 1px;
  flex: 1;
  background: var(--line);
  content: "";
}

.auth-note {
  margin: 0.25rem 0 0;
  color: var(--ink-soft);
  text-align: center;
  font-size: 0.78rem;
}

.auth-note a,
.auth-back-link {
  color: var(--leaf);
  font-weight: 800;
}

.auth-back-link {
  display: inline-block;
  margin-bottom: 2.5rem;
  font-size: 0.78rem;
}

.register-brand .login-mark {
  margin-bottom: 2.5rem;
}

.registration-form {
  padding-top: 2rem;
  padding-bottom: 2rem;
}

.profile-hero {
  align-items: center;
}

.profile-heading {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.profile-heading > div > p:last-child {
  margin-bottom: 0;
  color: var(--ink-soft);
}

.profile-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 78px;
  height: 78px;
  border-radius: 26px 26px 26px 8px;
  background: var(--peach);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.2rem;
  box-shadow: 0 14px 34px rgba(23, 63, 45, 0.12);
}

.account-grid {
  display: grid;
  gap: 1rem;
  max-width: 920px;
  margin: 0 auto;
}

.account-grid.single {
  max-width: 780px;
}

.account-form {
  display: grid;
  align-content: start;
  gap: 1rem;
}

.account-form-combined {
  gap: 1.5rem;
}

.account-section,
.account-fields {
  display: grid;
  gap: 1rem;
}

.password-section {
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.password-hint {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 699px) {
  .topbar {
    min-height: 62px;
    padding: 0.55rem 0.75rem;
  }

  .brand {
    gap: 0.55rem;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 12px 12px 12px 4px;
    font-size: 1.2rem;
  }

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

  .brand small {
    display: none;
  }

  .profile-button {
    width: 38px;
    height: 38px;
  }

  .profile-hero {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
  }

  .profile-heading {
    gap: 0.8rem;
  }

  .profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 18px 18px 18px 6px;
    font-size: 1.6rem;
  }

  .profile-heading h1 {
    margin-bottom: 0.2rem;
    font-size: 2rem;
  }

  .profile-heading > div > p:last-child {
    font-size: 0.78rem;
  }

  .profile-hero form,
  .profile-hero .secondary-button {
    width: 100%;
  }

  .account-form {
    padding: 1rem;
    border-radius: 18px;
  }

  .register-brand {
    display: none;
  }

  .registration-form {
    padding: 1.35rem;
  }

  .page-shell {
    width: min(100% - 1rem, 480px);
    padding-top: 1rem;
    padding-bottom: calc(6.5rem + env(safe-area-inset-bottom));
  }

  .filters {
    max-width: 100%;
    overflow: hidden;
  }

  .date-input,
  .datetime-input {
    height: 52px;
    padding-right: 0.75rem;
    overflow: hidden;
    -webkit-appearance: none;
    appearance: none;
  }

  .market-hero {
    align-items: center;
    margin-bottom: 1rem;
  }

  .market-hero h1 {
    margin-bottom: 0;
    font-size: 2.15rem;
  }

  .market-hero .eyebrow {
    margin-bottom: 0.25rem;
    font-size: 0.62rem;
  }

  .market-hero > div:first-child > p:last-child {
    display: none;
  }

  .market-today {
    padding: 0.6rem 0.75rem;
    border-radius: 14px;
  }

  .market-today strong {
    font-size: 1.15rem;
  }

  .market-layout {
    gap: 0.75rem;
  }

  .section-heading {
    align-items: center;
    margin-bottom: 0.65rem;
  }

  .section-heading h2 {
    font-size: 1.3rem;
  }

  .section-heading .text-link {
    font-size: 0.68rem;
  }

  .market-products {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .market-product {
    display: flex;
    min-height: 68px;
    flex-direction: column;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.5rem 0.25rem;
    border-radius: 14px;
    text-align: center;
  }

  .market-product .produce-dot {
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
  }

  .market-product strong {
    font-size: 0.75rem;
    line-height: 1.08;
    overflow-wrap: anywhere;
  }

  .market-product small {
    display: none;
  }

  .market-form.panel {
    padding: 0.85rem;
    border-radius: 18px;
  }

  .market-selection {
    margin-bottom: 0.7rem;
    padding-bottom: 0.7rem;
  }

  .market-selection span {
    font-size: 0.65rem;
  }

  .market-selection strong {
    font-size: 0.9rem;
  }

  .market-inputs {
    gap: 0.65rem;
  }

  .market-input input,
  .weight-step-button,
  .amount-step-button {
    min-height: 58px;
  }

  .market-input input {
    font-size: 1.4rem;
  }

  .weight-stepper,
  .amount-stepper {
    grid-template-columns: 56px minmax(0, 1fr) 56px;
    gap: 0.4rem;
  }

  .weight-step-button,
  .amount-step-button {
    font-size: 1.75rem;
  }

  .price-preview {
    min-height: 50px;
    padding: 0.65rem 0.8rem;
  }

  .price-preview strong {
    font-size: 1.1rem;
  }

  .market-payments {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    margin-top: 0.75rem;
  }

  .market-payments .sold-button {
    min-height: 62px;
    gap: 0.35rem;
    padding: 0.55rem 0.35rem;
    font-size: 0.7rem;
    line-height: 1.15;
  }

  .market-payments .sold-button span {
    width: 24px;
    height: 24px;
    font-size: 0.85rem;
  }
}

@media (min-width: 700px) {
  .page-shell {
    width: min(1180px, calc(100% - 4rem));
  }

  .hero-action {
    display: inline-flex;
  }

  .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
  }

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

  .mode-card {
    min-height: 96px;
  }

  .stat-card {
    min-height: 150px;
    padding: 1.35rem;
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr);
  }

  .sale-row {
    grid-template-columns: 10px minmax(180px, 1fr) minmax(90px, 0.4fr) minmax(110px, 0.5fr);
    gap: 1rem;
  }

  .sale-weight {
    display: block;
  }

  .form-page {
    grid-template-columns: minmax(240px, 0.75fr) minmax(430px, 1.35fr);
    align-items: start;
  }

  .form-intro {
    position: sticky;
    top: 110px;
  }

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

  .form-full,
  .price-preview {
    grid-column: 1 / -1;
  }

  .form-actions {
    grid-template-columns: 1fr 1fr;
  }

  .payment-actions {
    grid-template-columns: 1fr 1fr;
  }

  .filters {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
    align-items: end;
  }

  .filter-button {
    width: auto;
  }

  .list-summary {
    width: fit-content;
    min-width: 520px;
  }

  .list-summary.extended {
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .login-card {
    grid-template-columns: 1.05fr 0.95fr;
  }

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

  .account-grid.single {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .market-products {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .product-layout {
    grid-template-columns: minmax(250px, 0.65fr) minmax(440px, 1.35fr);
    align-items: start;
  }

  .product-create-form {
    position: sticky;
    top: 100px;
  }

  .managed-product {
    grid-template-columns: auto minmax(120px, 1fr) auto;
  }

  .product-actions {
    grid-column: auto;
    justify-content: flex-end;
  }
}

@media (min-width: 900px) {
  .sales-table-panel {
    padding: 0 1.25rem;
  }

  .sales-table thead {
    display: table-header-group;
  }

  .sales-table tbody {
    display: table-row-group;
  }

  .sales-table tr {
    position: static;
    display: table-row;
    padding: 0;
    border: 0;
  }

  .sales-table th,
  .sales-table td {
    display: table-cell;
    padding: 1rem 0.65rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
  }

  .sales-table th {
    color: var(--ink-soft);
    font-size: 0.68rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
  }

  .sales-table td::before {
    display: none;
  }

  .sales-table .action-cell {
    position: static;
    width: 40px;
    text-align: right;
  }

  .market-layout {
    grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
    align-items: start;
  }

  .market-form {
    position: sticky;
    top: 100px;
  }
}

@media (min-width: 1050px) {
  .desktop-nav {
    display: flex;
  }

  .mobile-nav {
    display: none;
  }

  .page-shell {
    padding-bottom: 4rem;
  }

  .filters {
    grid-template-columns: repeat(5, minmax(110px, 1fr)) auto auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
