:root {
  color-scheme: light;
  --ink: #15211e;
  --muted: #68736e;
  --line: #dfe5df;
  --soft: #f4f6f2;
  --paper: #ffffff;
  --brand: #10201b;
  --brand-2: #35a06f;
  --gold: #c7a45b;
  --danger: #b74b4b;
  --warn: #a8752a;
  --shadow: 0 18px 45px rgba(16, 32, 27, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-family: Arial, Helvetica, sans-serif;
  background: #f1f3ef;
  color: var(--ink);
}

body {
  min-height: 100vh;
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
}

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

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

button {
  cursor: pointer;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.auth-shell {
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(53, 160, 111, 0.12), rgba(199, 164, 91, 0.12)),
    #f2f4ef;
}

.app-shell {
  background: #f3f5f1;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.auth-card,
.panel,
.empty-state,
.metric,
.product-card {
  border: 1px solid rgba(21, 33, 30, 0.09);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(430px, 100%);
  padding: 28px;
}

.wide-auth {
  width: min(780px, 100%);
}

.setup-card {
  width: min(520px, 100%);
}

.auth-logo {
  display: block;
  width: 210px;
  max-width: 100%;
  height: auto;
  margin-bottom: 22px;
}

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

h1 {
  margin-bottom: 6px;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 14px;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0;
}

.muted,
.auth-note,
small {
  color: var(--muted);
}

.auth-note {
  margin: 18px 0 0;
  font-size: 14px;
}

.auth-note a,
.panel-head a {
  color: #237d58;
  font-weight: 700;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 74px;
  padding: 12px max(18px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgba(21, 33, 30, 0.08);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.brand img {
  display: block;
  width: 178px;
  height: auto;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.nav-link,
.ghost-button,
.small-button,
.secondary-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 8px 13px;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
}

.nav-link {
  color: #394641;
}

.nav-link.is-active,
.nav-link:hover {
  background: #edf3ed;
  color: var(--brand);
}

.main-nav form {
  margin-left: auto;
}

.ghost-button {
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
}

.primary-button {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.primary-button:hover {
  background: #1a322b;
}

.secondary-button,
.small-button {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.small-button {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 13px;
}

.danger {
  border-color: rgba(183, 75, 75, 0.22);
  color: var(--danger);
}

.full {
  width: 100%;
}

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin-bottom: 5px;
  color: #257d5a;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.form-stack,
.product-form {
  display: grid;
  gap: 14px;
}

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

label {
  display: grid;
  gap: 7px;
  color: #2f3b37;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #ccd5ce;
  border-radius: 7px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

textarea {
  min-height: 116px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(53, 160, 111, 0.14);
}

.span-2 {
  grid-column: span 2;
}

.check-row {
  align-content: end;
  grid-template-columns: 18px 1fr;
  align-items: center;
  min-height: 42px;
}

.check-row input {
  min-height: auto;
}

.alert {
  margin-bottom: 16px;
  border-radius: 7px;
  padding: 12px 14px;
  font-weight: 700;
}

.alert-success {
  background: #e9f6ee;
  color: #1b6e48;
}

.alert-error {
  background: #faeeee;
  color: #a93a3a;
}

.alert-info {
  background: #eef4fa;
  color: #365f86;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric {
  padding: 18px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
  line-height: 1;
}

.panel {
  padding: 20px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.responsive-table {
  overflow-x: auto;
}

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

th,
td {
  padding: 13px 10px;
  border-bottom: 1px solid #edf0ec;
  text-align: left;
  vertical-align: middle;
}

th {
  color: #5e6a65;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

td small {
  display: block;
  margin-top: 3px;
}

.product-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.product-cell img {
  width: 46px;
  height: 46px;
  border-radius: 7px;
  object-fit: cover;
  background: #edf0ec;
}

.actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.badge,
.category-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
}

.badge.ok {
  background: #e7f5ec;
  color: #1f744e;
}

.badge.warn {
  background: #fff4df;
  color: var(--warn);
}

.badge.danger {
  background: #faeeee;
  color: var(--danger);
}

.badge.soft {
  background: #edf0ec;
  color: #6a746f;
}

.split-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
}

.image-preview {
  width: 180px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--soft);
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 220px auto;
  gap: 10px;
  margin-bottom: 16px;
}

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

.product-card {
  overflow: hidden;
  box-shadow: none;
}

.product-card > img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #e9ede8;
}

.product-body {
  display: grid;
  gap: 10px;
  padding: 15px;
}

.category-pill {
  width: fit-content;
  background: #edf3ed;
  color: #237d58;
}

.product-body h2 {
  margin: 0;
  font-size: 17px;
}

.product-body p {
  min-height: 46px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.product-meta,
.cart-footer,
.buy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.product-meta strong {
  font-size: 16px;
}

.product-meta span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.buy-row input {
  width: 76px;
  min-height: 38px;
}

.checkout-box {
  display: grid;
  gap: 14px;
  max-width: 560px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.qty-input {
  width: 82px;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 44px 24px;
  text-align: center;
}

.empty-state.compact {
  padding: 28px 18px;
  box-shadow: none;
}

.status-list {
  display: grid;
  gap: 10px;
  width: min(520px, 100%);
  margin: 10px 0 14px;
}

.status-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #eadfca;
  border-radius: 7px;
  padding: 12px;
  background: #fff8eb;
}

.status-item.done {
  border-color: #cde8d7;
  background: #edf8f1;
}

@media (max-width: 920px) {
  .topbar {
    flex-wrap: wrap;
    padding-inline: 16px;
  }

  .nav-toggle {
    display: inline-grid;
    place-items: center;
  }

  .main-nav {
    display: none;
    flex-basis: 100%;
    align-items: stretch;
    flex-direction: column;
    padding-top: 8px;
  }

  .main-nav.is-open {
    display: flex;
  }

  .main-nav form {
    margin-left: 0;
  }

  .nav-link,
  .ghost-button {
    justify-content: flex-start;
    width: 100%;
  }

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

  .split-layout {
    grid-template-columns: 1fr;
  }

  .filter-bar {
    grid-template-columns: 1fr 1fr;
  }

  .filter-bar button {
    grid-column: span 2;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 14px;
  }

  .auth-shell {
    padding: 16px;
  }

  .page {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .brand img {
    width: 154px;
  }

  .auth-card,
  .panel {
    padding: 18px;
  }

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

  .page-head .primary-button,
  .page-head .secondary-button {
    width: 100%;
  }

  .form-grid,
  .metric-grid,
  .product-grid,
  .filter-bar {
    grid-template-columns: 1fr;
  }

  .span-2,
  .filter-bar button {
    grid-column: span 1;
  }

  .actions,
  .cart-footer,
  .buy-row {
    align-items: stretch;
    flex-direction: column;
  }

  .buy-row input,
  .buy-row button,
  .cart-footer button {
    width: 100%;
  }

  h1 {
    font-size: 22px;
  }

  .metric strong {
    font-size: 24px;
  }
}

