.inventory {
  max-width: 1100px;
  margin: auto;
}
.inv-heading,
.inv-actions,
.inv-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.inv-heading {
  justify-content: space-between;
}
.inv-heading h2 {
  margin: 8px 0;
}
.inv-heading label {
  min-width: 140px;
}
.inv-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 22px 0 10px;
}
.inv-tabs button {
  min-height: 48px;
}
.inv-help {
  padding: 16px;
  background: #eef1e9;
  border-radius: 14px;
  margin: 12px 0 22px;
}
.inv-help summary,
.inventory summary {
  cursor: pointer;
  font-weight: 650;
}
.inv-filters {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
  margin: 18px 0;
}
.inv-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(285px, 1fr));
  gap: 16px;
}
.inv-cards .card {
  min-width: 0;
}
.inv-cards h3 {
  overflow-wrap: anywhere;
}
.inv-actions {
  margin-top: 14px;
}
.inventory button,
.inventory-dialog button {
  min-height: 44px;
}
.inv-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.inv-metrics dt {
  font-size: 13px;
  color: #636b60;
}
.inv-metrics dd {
  margin: 4px 0;
  font-size: 20px;
  font-weight: 650;
}
.inv-metrics small {
  font-size: 13px;
  font-weight: 400;
}
.inv-error,
.inv-warning {
  color: #8a3426;
}
.inv-warning {
  background: #fff2dc;
  padding: 15px;
  border-radius: 12px;
  margin-bottom: 18px;
}
.inv-notice:empty {
  display: none;
}
.inventory-dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: 90dvh;
  box-sizing: border-box;
  padding: 22px;
  border: 1px solid #d8ddce;
  border-radius: 18px;
  overflow: auto;
}
.inventory-dialog::backdrop {
  background: #14231588;
}
.inventory-dialog form {
  display: block;
}
.inventory-dialog label {
  display: block;
  margin: 12px 0;
}
.inventory-dialog input,
.inventory-dialog select,
.inventory-dialog textarea {
  width: 100%;
  box-sizing: border-box;
  margin-top: 6px;
}
.inventory-dialog details {
  margin: 18px 0;
}
.inventory-dialog fieldset {
  margin: 14px 0;
  border: 1px solid #d8ddce;
  border-radius: 12px;
}
.inv-ledger p {
  border-bottom: 1px solid #ddd;
  padding: 10px 0;
}
.journal-stock-link {
  display: block;
  color: #346442;
  margin: 6px 0;
}
.journal-stock-link.warning {
  color: #8a3426;
}
@media (max-width: 600px) {
  .inv-filters {
    grid-template-columns: 1fr;
  }
  .inv-cards {
    grid-template-columns: 1fr;
  }
  .inv-actions button {
    flex: 1 1 130px;
  }
  .inventory-dialog {
    padding: 16px;
  }
  .inv-tabs {
    gap: 5px;
  }
  .inv-tabs button {
    padding: 10px 8px;
  }
}

.inv-overview {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 18px 0;
}
.inv-overview section {
  padding: 18px;
  background: #f2f3e9;
  border-radius: 14px;
}
.inv-overview h3 {
  margin-top: 0;
}
.inv-category-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 18px 0;
}
.inv-category-pills button {
  font-size: 13px;
}
@media (max-width: 600px) {
  .inv-overview {
    grid-template-columns: 1fr;
  }
  .inv-category-pills {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

.inv-need-group {
  margin: 26px 0 36px;
}
.inv-need-group > header {
  border-bottom: 2px solid #d8dfcf;
  margin-bottom: 16px;
  padding-bottom: 12px;
}
.inv-need-group > header h3 {
  font-size: 22px;
  margin: 0 0 6px;
}
.inv-need-group > header h3 small {
  font-size: 13px;
  font-weight: 400;
  display: inline-block;
  margin-left: 8px;
  color: #626c5e;
}
.inv-need-group > header p {
  margin: 0;
  color: #626c5e;
  font-size: 14px;
}
/* Compact inventory: continuous rows, details only on request. */
.inventory .inv-heading h2 {
  font-size: 19px;
  font-weight: 550;
  color: #56634f;
}
.inventory .inv-heading label {
  max-width: 180px;
}
.inventory .inv-tabs {
  gap: 0;
  border-bottom: 1px solid #cbd5c5;
  margin: 12px 0 18px;
}
.inventory .inv-tabs button {
  background: transparent;
  color: #5c6857;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  box-shadow: none;
  font-weight: 600;
}
.inventory .inv-tabs button[aria-pressed='true'] {
  color: #215f36;
  border-bottom-color: #215f36;
}
.inventory .inv-help {
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  font-size: 14px;
  color: #586652;
  margin: 12px 0;
}
.inventory .inv-help summary {
  padding: 10px 0;
}
.inventory .inv-overview {
  display: block;
  margin: 10px 0 18px;
  border-top: 1px solid #d8dfd1;
  border-bottom: 1px solid #d8dfd1;
}
.inv-overview > details {
  padding: 12px 0;
}
.inv-overview > details + details {
  border-top: 1px solid #e1e6dc;
}
.inv-overview summary {
  display: list-item;
  list-style-position: inside;
  font-size: 14px;
}
.inv-overview summary strong {
  float: right;
  font-weight: 600;
}
.inv-overview summary span {
  margin-left: 4px;
}
.inv-overview p {
  font-size: 14px;
  color: #586652;
}
.inventory .inv-cards {
  display: block;
}
.inventory .inv-cards > .card {
  box-shadow: none;
  border: 0;
  border-bottom: 1px solid #d8dfd1;
  border-radius: 0;
  background: transparent;
  margin: 0;
  padding: 20px 0;
}
.inv-product-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.inv-product-name {
  min-width: 0;
  flex: 1;
}
.inventory .inv-product-name h3 {
  font-size: 19px;
  line-height: 1.3;
  margin: 5px 0 4px;
}
.inv-product-name > .ey {
  font-size: 11px;
  letter-spacing: 0.07em;
  color: #697762;
}
.inv-product-name > small {
  font-size: 13px;
  color: #697762;
}
.inv-product-amount {
  display: grid;
  gap: 4px;
  flex: 0 0 auto;
  text-align: right;
  padding-top: 2px;
  max-width: 48%;
  overflow-wrap: anywhere;
}
.inv-product-amount > span {
  font-size: 12px;
  color: #697762;
}
.inv-product-amount > strong {
  font-size: 22px;
  line-height: 1.3;
}
.inv-product-amount strong small {
  font-size: 13px;
  font-weight: 500;
}
.inv-product-amount > small {
  font-size: 13px;
  color: #697762;
}
.inv-product-amount.inv-shortage > strong {
  color: #925321;
}
.inv-product-details {
  margin: 12px 0 0;
}
.inv-product-details > summary {
  font-size: 13px;
  color: #386744;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.inv-product-details > summary:before {
  content: '+';
  font-size: 20px;
  font-weight: 400;
}
.inv-product-details[open] > summary:before {
  content: '−';
}
.inv-product-body {
  padding: 4px 0 8px;
}
.inv-product-body > p {
  font-size: 14px;
  color: #586652;
}
.inv-product-body .inv-actions {
  margin: 14px 0;
}
.inventory .inv-cost-summary {
  background: transparent;
  border: 0;
  border-left: 3px solid #54805a;
  border-radius: 0;
  box-shadow: none;
  padding: 8px 0 8px 16px;
  margin: 22px 0;
}
.inv-cost-summary > strong {
  font-size: 28px;
}
.inventory .inv-cost-summary h3 {
  font-size: 16px;
}
.inv-cost-summary > p {
  font-size: 13px;
  color: #697762;
}
.inventory .inv-metrics {
  gap: 12px;
  border-top: 1px solid #d8dfd1;
  padding-top: 12px;
}
.inv-metrics dd {
  font-size: 17px;
}
.inventory .inv-need-group > header {
  border: 0;
  margin: 26px 0 0;
  padding: 0;
}
.inv-need-group > header h3 {
  font-size: 19px;
}
.inv-need-group > header p {
  font-size: 13px;
}
.inventory .inv-filters {
  margin: 18px 0 8px;
}
.inventory .inv-filters input,
.inventory .inv-filters select {
  min-height: 46px;
}
@media (max-width: 600px) {
  .inventory .inv-heading {
    gap: 8px;
  }
  .inventory .inv-heading h2 {
    font-size: 16px;
    margin: 0;
  }
  .inventory .inv-heading label {
    min-width: 120px;
    max-width: 140px;
    font-size: 12px;
  }
  .inventory .inv-filters {
    grid-template-columns: minmax(0, 1fr) 130px;
    gap: 8px;
  }
  .inv-filters label {
    font-size: 12px;
    min-width: 0;
  }
  .inv-filters input,
  .inv-filters select {
    width: 100%;
    min-width: 0;
    font-size: 14px;
  }
  .inventory .inv-product-name h3 {
    font-size: 17px;
  }
  .inv-product-amount > strong {
    font-size: 20px;
  }
}
.inventory .inv-overview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.inv-overview > details + details {
  border-top: 0;
}
.inv-overview summary strong {
  display: block;
  float: none;
  margin: 6px 0 0 17px;
  font-size: 17px;
  color: #335d3c;
}
.inventory > .inv-help {
  border-top: 1px solid #d8dfd1;
  margin-top: 24px;
  padding-top: 8px;
}
/* Tilukset palette and typography, with one calm introductory surface. */
.inventory .inv-heading {
  background: linear-gradient(125deg, #183b2a, #326448);
  color: #fff;
  padding: 24px;
  border-radius: 20px;
  gap: 20px;
  position: relative;
  overflow: hidden;
}
.inventory .inv-heading h2 {
  color: #fff;
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.7px;
  margin: 8px 0;
}
.inv-heading p {
  color: #d5e4d4;
  font-size: 14px;
  margin: 0;
}
.inv-eyebrow {
  font-size: 10px;
  letter-spacing: 0.16em;
  font-weight: 700;
  color: #c9d9a7;
}
.inventory .inv-heading label {
  color: #dce8db;
  font-size: 12px;
  min-width: 125px;
}
.inventory .inv-heading select {
  background: #ffffff14;
  color: #fff;
  border: 1px solid #ffffff55;
  border-radius: 10px;
  min-height: 46px;
}
.inventory .inv-heading select option {
  color: #203d29;
  background: #fff;
}
.inventory .inv-tabs {
  margin: 20px 0;
  background: #e7eddf;
  padding: 4px;
  border: 0;
  border-radius: 14px;
  gap: 4px;
}
.inventory .inv-tabs button {
  border: 0;
  border-radius: 10px;
  min-height: 46px;
}
.inventory .inv-tabs button[aria-pressed='true'] {
  background: #fff;
  color: #205334;
  box-shadow: 0 2px 6px #193d2512;
}
.inventory .inv-overview {
  border-top: 0;
  border-bottom: 1px solid #d4ddcc;
  padding-bottom: 10px;
  margin: 4px 0 16px;
}
.inventory .inv-overview summary {
  font-weight: 500;
  color: #586b53;
}
.inventory .inv-overview summary strong {
  font-size: 21px;
  letter-spacing: -0.4px;
  color: #254d32;
}
.inventory .inv-filters {
  padding: 16px 0 4px;
  margin-top: 0;
}
.inventory .inv-filters label {
  font-size: 12px;
  font-weight: 600;
  color: #50634a;
}
.inventory .inv-filters input,
.inventory .inv-filters select {
  background: #fff;
  border: 1px solid #d2ddcb;
  border-radius: 12px;
  padding: 12px;
  min-height: 50px;
  box-shadow: 0 2px 8px #193d2505;
}
.inventory .inv-filters input:focus,
.inventory .inv-filters select:focus {
  outline: 2px solid #699568;
  outline-offset: 2px;
}
.inv-search-hint {
  color: #6a7961;
  line-height: 1.8;
  font-size: 14px;
  padding: 14px 2px 22px;
  max-width: 560px;
}
.inv-result-count {
  font-size: 13px;
  color: #61755a;
  margin: 18px 0 0;
}
.inventory .inv-product-row {
  transition: background 0.15s;
}
.inventory .inv-product-row:has(details[open]) {
  background: #eaf0e34d;
}
.inventory .inv-product-name > .ey {
  color: #628058;
}
.inventory .inv-product-amount > strong {
  color: #264e33;
}
.inventory .inv-product-amount.inv-shortage > strong {
  color: #925321;
}
@media (max-width: 600px) {
  .inventory .inv-heading {
    padding: 20px;
    gap: 18px;
    align-items: flex-end;
  }
  .inventory .inv-heading > div {
    width: 100%;
  }
  .inventory .inv-heading h2 {
    font-size: 25px;
  }
  .inventory .inv-heading label {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: none;
    width: 100%;
    font-size: 12px;
  }
  .inventory .inv-heading select {
    flex: 1;
  }
  .inventory .inv-tabs {
    margin: 16px 0 8px;
  }
  .inventory .inv-filters input,
  .inventory .inv-filters select {
    font-size: 16px;
    padding: 10px;
  }
}

.inv-pending {
  margin: 0 0 1rem;
  padding: 1rem;
  background: #edf5ef;
  border-radius: 16px;
}
.inv-pending summary {
  font-weight: 700;
  color: #24563b;
  cursor: pointer;
}
.inv-pending-list {
  max-height: 300px;
  overflow-y: auto;
}
.inv-pending-list article {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.75rem 0;
  border-top: 1px solid #cfdfd4;
}
.inv-pending-list article > div {
  flex: 1 1 160px;
}
.inv-pending-list small {
  display: block;
}
.inv-pending-list button {
  min-height: 44px;
}
