:root {
  --bg: #f3f4f0;
  --ink: #0b0f0d;
  --muted: #5c6b65;
  --brand: #0f3d2e;
  --brand-2: #1a5a45;
  --card: #ffffff;
  --line: #d8ddd7;
  --accent: #f5c44b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "IBM Plex Sans", "Avenir Next", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #eef1ea 0%, #f8f7f2 100%);
}

body.home {
  min-height: 100vh;
  color: #f2f2f2;
  background: radial-gradient(circle at 20% 20%, rgba(86, 255, 187, 0.08), transparent 45%),
    radial-gradient(circle at 80% 20%, rgba(255, 190, 90, 0.07), transparent 45%),
    radial-gradient(circle at 50% 80%, rgba(120, 170, 255, 0.06), transparent 50%),
    #050505;
}

body.home::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 36px 36px;
  opacity: 0.25;
  pointer-events: none;
}

body.home .page {
  max-width: none;
  padding: 0;
}

.home-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px 6vw 40px;
  position: relative;
  z-index: 1;
}

.home-hero {
  display: grid;
  place-items: center;
  min-height: 62vh;
}

.logo-parallax {
  display: grid;
  place-items: center;
  width: 100%;
  padding: 12px 0;
}

.home-logo {
  width: min(72vw, 760px);
  height: auto;
  transform: translate3d(var(--parallax-x, 0px), var(--parallax-y, 0px), 0);
  filter: drop-shadow(0 25px 60px rgba(0, 0, 0, 0.6));
  transition: filter 0.2s ease;
}

.home-footer {
  display: flex;
  justify-content: center;
  padding-top: 20px;
}

.home-links {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: center;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 11px;
}

.home-links a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.home-links a:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 700px) {
  .home-shell {
    padding: 32px 6vw 28px;
  }

  .home-logo {
    width: min(86vw, 520px);
  }

  .home-links {
    letter-spacing: 0.14em;
    gap: 12px;
  }
}

.page {
  max-width: 1600px;
  margin: 0 auto;
  padding: 10px 12px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 16px;
  background: var(--brand);
  color: white;
  border-radius: 16px;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.12em;
  font-size: 14px;
}

.brand-logo {
  display: block;
  height: 28px;
  width: auto;
  object-fit: contain;
}

.order-title {
  font-size: 18px;
  font-weight: 600;
}

.actions {
  display: flex;
  gap: 8px;
}

.btn {
  border: none;
  background: var(--accent);
  color: #1d1d1d;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}

.btn:active {
  transform: translateY(1px);
}

.table-wrap {
  margin-top: 16px;
  background: var(--card);
  border-radius: 16px;
  border: 1px solid var(--line);
  overflow: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.sheet {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
  table-layout: fixed;
}

.sheet th,
.sheet td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 8px;
  font-size: 13px;
  text-align: left;
  min-width: 0;
  word-break: break-word;
}

.sheet tbody tr:nth-child(even) td {
  background: #f6f8f4;
}

.sheet tbody tr.active-row td {
  background: #eef5ef;
}

.sheet tbody tr.active-row td.sticky-col {
  background: #e7efe8;
}

.sheet th.delete-col,
.sheet td.delete-col {
  width: 36px;
  min-width: 36px;
  text-align: center;
}

.sheet th {
  position: sticky;
  top: 0;
  background: #e6ede7;
  font-weight: 600;
  z-index: 3;
  padding-top: 18px;
}

.sheet th .unit-hint {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #dfe7df;
  color: #2f3f38;
  font-size: 9px;
  font-weight: 600;
}

.sheet th.sticky-col,
.sheet td.sticky-col {
  position: sticky;
  z-index: 2;
  background: #eef2ee;
}

.sheet td.sticky-col {
  background: #f1f5f1;
}

.sheet th.sticky-0,
.sheet td.sticky-0 {
  left: 0;
  width: 48px;
  min-width: 48px;
  max-width: 48px;
}

.sheet th.sticky-1,
.sheet td.sticky-1 {
  left: 48px;
  width: 180px;
  min-width: 180px;
  max-width: 180px;
}

.sheet th.sticky-2,
.sheet td.sticky-2 {
  left: 228px;
  width: 120px;
  min-width: 120px;
  max-width: 120px;
}


.cell-input,
.cell-select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  font-size: 14px;
  min-height: 34px;
}

.cell-readonly {
  font-weight: 600;
  color: var(--brand-2);
}

.delete-row-btn {
  border: none;
  background: #f1f3ee;
  color: #5c6b65;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.delete-row-btn:hover {
  background: #e4e9e2;
  color: #2a3a33;
}

.suggestion {
  margin-top: 6px;
  font-size: 10px;
  color: var(--muted);
  display: flex;
  gap: 6px;
  align-items: center;
}

.suggestion[data-mode="match"] .suggestion-text {
  color: #1a5a45;
  font-weight: 600;
}

.suggestion[data-mode="nearest"] .suggestion-text {
  color: #4b5b54;
  font-weight: 600;
}

.cards {
  display: none;
  margin-top: 16px;
  gap: 12px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  display: grid;
  gap: 10px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.06);
}

.card h3 {
  margin: 0;
  font-size: 16px;
  color: var(--brand-2);
}

.card label {
  font-size: 12px;
  color: var(--muted);
  display: grid;
  gap: 6px;
  grid-template-columns: auto auto;
  align-items: center;
  position: relative;
  padding-top: 12px;
}

.card input,
.card select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
}

.card .unit-hint {
  position: absolute;
  top: 4px;
  right: 0;
  padding: 2px 6px;
  border-radius: 999px;
  background: #e7ece7;
  color: #2f3f38;
  font-size: 9px;
  font-weight: 600;
}

@media (max-width: 900px) {
  .sheet th .unit-hint,
  .card .unit-hint {
    padding: 1px 5px;
    font-size: 9px;
  }
}

.card .readonly {
  padding: 8px 10px;
  background: #f3f6f1;
  border-radius: 10px;
  font-weight: 600;
}

.card .delete-row-btn.card-delete {
  justify-self: end;
  margin-top: 6px;
}

.add-card {
  align-items: center;
  justify-items: center;
  text-align: center;
  border: 2px dashed #c5d3c8;
  background: #f7faf6;
  color: var(--brand-2);
  cursor: pointer;
}

.add-card .plus {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: var(--accent);
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 700;
}

.footer-row {
  background: #f4f8f2;
  font-weight: 600;
}

.add-row td {
  padding: 14px 12px;
  text-align: center;
  font-weight: 600;
  border: 2px dashed #c5d3c8;
  background: #f7faf6;
  cursor: pointer;
  color: var(--brand-2);
}

.add-row .plus {
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--accent);
  color: #1d1d1d;
  margin-right: 8px;
}

.admin-page {
  max-width: 800px;
}

.admin-card {
  margin-top: 16px;
  background: var(--card);
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 16px;
}

.form {
  display: grid;
  gap: 12px;
}

.form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.columns-fieldset {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 6px;
}

.columns-fieldset legend {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-2);
  padding: 0 6px;
}

.columns-fieldset label {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.form input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.form input[type="checkbox"] {
  width: 20px;
  height: 20px;
  padding: 0;
  margin: 0;
  border-radius: 6px;
}

.form select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 14px;
}

.result {
  margin-top: 12px;
  font-size: 13px;
  color: var(--brand-2);
}

.orders-list {
  font-size: 13px;
  color: var(--muted);
}

.order-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed #d7ded6;
}

.order-actions {
  display: flex;
  gap: 8px;
}

.mini-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: none;
  border-radius: 999px;
  background: #f1f3ee;
  color: #2a3a33;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.mini-btn:hover {
  background: #e2e7e1;
}

.mini-btn-danger {
  border: 1px solid #e4caca;
  background: #fff3f3;
  color: #7a2a2a;
}

.mini-btn-danger:hover {
  background: #fdeaea;
}

.total-word {
  letter-spacing: 0.08em;
  white-space: nowrap;
  font-weight: 700;
}

.step-fieldset {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 12px;
}

.step-fieldset legend {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-2);
  padding: 0 6px;
}

.step-fieldset.is-locked {
  opacity: 0.55;
}

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

.mini-note {
  font-size: 12px;
  color: var(--muted);
}

.products-grid {
  display: grid;
  gap: 12px;
}

.product-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fbfcfa;
  display: grid;
  gap: 10px;
}

.product-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
}

.product-toggle strong {
  font-size: 16px;
  line-height: 1.15;
}

.product-params {
  border-top: 1px dashed #d7ded6;
  padding-top: 10px;
  display: grid;
  gap: 8px;
}

.tiny-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #314139;
}

.param-options {
  margin: 2px 0 0 24px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid #dce3db;
  background: #f5f8f3;
  display: grid;
  gap: 8px;
}

.param-options.is-disabled {
  opacity: 0.45;
}

.param-options-title {
  font-size: 11px;
  font-weight: 600;
  color: #3c4d45;
}

.param-options-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .actions {
    justify-content: flex-start;
  }

  .table-wrap {
    display: none;
  }

  .cards {
    display: grid;
  }

  .step-grid {
    grid-template-columns: 1fr;
  }
}

.custom-color-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.custom-color-input input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 12px;
}

.btn-add-color {
  background: var(--accent);
  color: #1d1d1d;
  border: none;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
}

.btn-add-color:active {
  transform: translateY(1px);
}
