:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f2ee;
  color: #1f2933;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(23, 88, 86, 0.14), transparent 34%),
    linear-gradient(315deg, rgba(164, 46, 72, 0.10), transparent 38%),
    #f7f4ef;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  padding: 28px clamp(18px, 4vw, 52px) 20px;
  border-bottom: 1px solid rgba(31, 41, 51, 0.1);
}

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

h1 {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 760;
}

.topbar p {
  max-width: 700px;
  margin-top: 8px;
  color: #52616d;
}

.totals {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.totals span {
  border: 1px solid rgba(31, 41, 51, 0.12);
  background: rgba(255, 255, 255, 0.72);
  padding: 10px 12px;
  border-radius: 8px;
  min-width: 104px;
  text-align: right;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 390px) minmax(280px, 390px);
  gap: 18px;
  padding: 22px clamp(18px, 4vw, 52px) 48px;
}

.panel,
.inventory {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(31, 41, 51, 0.12);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(31, 41, 51, 0.06);
}

.panel {
  padding: 18px;
}

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

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

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #384650;
}

input,
select,
button {
  width: 100%;
  border-radius: 8px;
  font: inherit;
}

input,
select {
  border: 1px solid #c8d0d6;
  background: #fff;
  padding: 10px 11px;
  min-height: 42px;
  color: #1f2933;
}

button {
  border: 0;
  background: #146c68;
  color: white;
  min-height: 44px;
  padding: 10px 14px;
  font-weight: 760;
  cursor: pointer;
}

button:hover {
  background: #0f5956;
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.inventory {
  grid-column: 1 / -1;
  padding: 18px;
}

.inventory-head input {
  max-width: 340px;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.card {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 13px;
  border: 1px solid rgba(31, 41, 51, 0.12);
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  min-height: 132px;
}

.thumb {
  width: 92px;
  height: 108px;
  border-radius: 8px;
  object-fit: cover;
  background: #e8edf0;
  border: 1px solid rgba(31, 41, 51, 0.1);
}

.placeholder {
  display: grid;
  place-items: center;
  color: #687783;
  font-size: 12px;
  text-align: center;
  padding: 8px;
}

.card-body {
  min-width: 0;
}

.meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.pill {
  font-size: 12px;
  font-weight: 750;
  background: #edf7f6;
  color: #146c68;
  border-radius: 999px;
  padding: 4px 8px;
}

.pill.warn {
  background: #fff2d8;
  color: #875300;
}

.pill.out {
  background: #ffe8e8;
  color: #a32222;
}

.name {
  font-weight: 780;
  overflow-wrap: anywhere;
}

.subname,
.costs,
.sales-item {
  color: #52616d;
  font-size: 13px;
  line-height: 1.45;
}

.costs {
  margin-top: 7px;
}

.delete {
  margin-top: 10px;
  min-height: 34px;
  background: #8d2f45;
  font-size: 13px;
}

.delete:hover {
  background: #74283a;
}

.sales {
  margin-top: 18px;
  border-top: 1px solid rgba(31, 41, 51, 0.1);
  padding-top: 14px;
}

.sales h3 {
  font-size: 15px;
  margin-bottom: 10px;
}

.sales-list {
  display: grid;
  gap: 8px;
  max-height: 244px;
  overflow: auto;
}

.sales-item {
  border: 1px solid rgba(31, 41, 51, 0.1);
  border-radius: 8px;
  padding: 9px;
  background: #fff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%) translateY(20px);
  background: #1f2933;
  color: white;
  padding: 10px 14px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  max-width: min(520px, calc(100vw - 32px));
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 860px) {
  .topbar,
  .layout {
    display: grid;
    grid-template-columns: 1fr;
  }

  .totals {
    justify-content: stretch;
  }

  .totals span {
    text-align: left;
    flex: 1;
  }
}

@media (max-width: 520px) {
  .grid-two,
  .card {
    grid-template-columns: 1fr;
  }

  .thumb {
    width: 100%;
    height: 190px;
  }

  .inventory-head {
    align-items: stretch;
    flex-direction: column;
  }

  .inventory-head input {
    max-width: none;
  }
}
