:root {
  --ink: #102019;
  --muted: #65736d;
  --line: rgba(18, 58, 41, 0.14);
  --green: #52c716;
  --green-dark: #238111;
  --cyan: #0093dd;
  --mint: #dffff0;
  --paper: #fbfff8;
  --shadow: 0 18px 48px rgba(10, 48, 31, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 8%, rgba(82, 199, 22, 0.16), transparent 24rem),
    radial-gradient(circle at 92% 0%, rgba(0, 147, 221, 0.15), transparent 28rem),
    linear-gradient(135deg, #f8fff3 0%, #eefbf5 48%, #f7fff9 100%);
}

button,
select,
input {
  font: inherit;
}

button,
.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid rgba(82, 199, 22, 0.3);
  border-radius: 12px;
  padding: 0 14px;
  background: linear-gradient(135deg, #52c716, #28b8b7);
  color: #052015;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(82, 199, 22, 0.16);
}

button.secondary,
.ghost-link {
  background: rgba(255, 255, 255, 0.72);
  color: #143524;
  box-shadow: none;
}

.inventory-shell {
  --sticky-top: 8px;
  --hero-stack: 94px;
  --control-stack: 84px;
  --action-stack: 78px;
  width: min(1480px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 42px;
}

.inventory-hero {
  position: sticky;
  top: var(--sticky-top);
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 84px;
  padding: 12px 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(232, 255, 243, 0.82)),
    #fff;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-lockup img {
  width: 150px;
  max-width: 35vw;
  object-fit: contain;
}

.brand-lockup span,
.control-strip span,
.panel-title span,
.workflow small,
.summary-grid span,
.posting-card span,
.invoice-head span {
  color: var(--green-dark);
  font-size: 0.74rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

.brand-lockup h1 {
  font-size: clamp(1.55rem, 3.4vw, 3.2rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.control-strip {
  position: sticky;
  top: calc(var(--sticky-top) + var(--hero-stack));
  z-index: 11;
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(5, minmax(120px, 1fr));
  gap: 10px;
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
  box-shadow: 0 14px 34px rgba(10, 48, 31, 0.1);
}

label {
  display: grid;
  gap: 6px;
}

input,
select {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(82, 199, 22, 0.28);
  border-radius: 11px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
  font-weight: 850;
}

.app-grid {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.side-panel,
.work-panel,
.top-action-bar {
  min-width: 0;
}

.side-panel,
.invoice-card,
.billing-card,
.product-card,
.history-card,
.top-action-bar {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.side-panel {
  position: sticky;
  top: calc(var(--sticky-top) + var(--hero-stack) + var(--control-stack) + var(--action-stack));
  padding: 14px;
}

.top-action-bar {
  position: sticky;
  top: calc(var(--sticky-top) + var(--hero-stack) + var(--control-stack));
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin: 0 0 12px;
  padding: 10px 12px;
  background:
    radial-gradient(circle at 0 0, rgba(82, 199, 22, 0.12), transparent 16rem),
    rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
}

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

.panel-title strong {
  display: grid;
  place-items: center;
  min-width: 44px;
  height: 34px;
  border-radius: 999px;
  background: #e8fbff;
  color: #0676b8;
  font-weight: 950;
}

.container-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 186px);
  overflow-y: auto;
  padding-right: 4px;
}

.container-card {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid rgba(82, 199, 22, 0.18);
  border-radius: 14px;
  padding: 10px;
  background: rgba(248, 255, 246, 0.9);
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.container-card.active {
  border-color: rgba(0, 147, 221, 0.5);
  background: linear-gradient(135deg, #eefdff, #efffe7);
}

.container-card strong {
  font-size: 1rem;
  font-weight: 950;
}

.container-card span,
.empty,
.status,
.posting-card small,
.container-card small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.workflow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.workflow article,
.summary-grid article,
.posting-card {
  border: 1px solid rgba(82, 199, 22, 0.2);
  border-radius: 18px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.78);
}

.workflow article {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.workflow article span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #e9f9df;
  color: var(--green-dark);
  font-weight: 950;
}

.workflow article.active span {
  background: linear-gradient(135deg, #52c716, #00b4d8);
  color: #031b13;
}

.workflow strong {
  display: block;
  font-size: 0.98rem;
  font-weight: 950;
}

.workflow small {
  display: block;
  margin-top: 2px;
  letter-spacing: 0;
  text-transform: none;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.summary-grid strong {
  display: block;
  margin-top: 5px;
  font-size: clamp(1.25rem, 2.2vw, 2rem);
  font-weight: 950;
}

.product-card {
  margin-bottom: 14px;
  overflow: hidden;
}

.product-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.56fr);
  gap: 14px;
  align-items: start;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 100% 0, rgba(82, 199, 22, 0.13), transparent 17rem),
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(231, 250, 255, 0.78));
}

.product-head span,
.product-form-title span,
.similar-head span {
  color: var(--green-dark);
  font-size: 0.74rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.product-head h2 {
  margin-top: 4px;
  font-size: 1.45rem;
}

.product-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.product-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.95fr) minmax(360px, 1.45fr) minmax(260px, 0.95fr);
  gap: 12px;
  padding: 16px;
}

.product-results,
.similar-products-list {
  display: grid;
  align-content: start;
  gap: 7px;
  max-height: 430px;
  overflow-y: auto;
  padding-right: 4px;
}

.product-result,
.similar-product {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  border: 1px solid rgba(82, 199, 22, 0.18);
  border-radius: 12px;
  padding: 7px;
  background: rgba(248, 255, 246, 0.88);
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.product-result.active,
.similar-product:hover {
  border-color: rgba(0, 147, 221, 0.46);
  background: linear-gradient(135deg, #eefdff, #efffe7);
}

.product-thumb {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(82, 199, 22, 0.2);
  border-radius: 9px;
  background: #fff;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 950;
  overflow: hidden;
}

.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-result strong,
.similar-product strong {
  display: block;
  overflow: hidden;
  font-size: 0.84rem;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-result span,
.similar-product span {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-result small,
.similar-product small {
  display: block;
  margin-top: 3px;
  color: #075f94;
  font-size: 0.72rem;
  font-weight: 950;
}

.product-form {
  min-width: 0;
  border: 1px solid rgba(82, 199, 22, 0.18);
  border-radius: 14px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.8);
}

.product-form-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.product-form-title strong {
  overflow: hidden;
  color: #075f94;
  font-weight: 950;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.product-form-grid label {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 950;
  text-transform: uppercase;
}

.product-form-grid .wide {
  grid-column: 1 / -1;
}

.product-form-grid .price-field {
  border: 1px solid rgba(0, 147, 221, 0.18);
  border-radius: 13px;
  padding: 8px;
  background: linear-gradient(135deg, rgba(231, 250, 255, 0.78), rgba(255, 255, 255, 0.9));
}

.product-form-grid .price-field input {
  margin-top: 6px;
  font-size: 1.05rem;
  font-weight: 950;
}

.product-form-grid .cost-field {
  color: #075f94;
  border-color: rgba(0, 147, 221, 0.26);
}

.product-form-grid .cost-field input {
  color: #075f94;
  background: rgba(255, 255, 255, 0.92);
}

.product-form-grid .unit-field {
  color: var(--green-dark);
  border-color: rgba(82, 199, 22, 0.42);
  background: linear-gradient(135deg, rgba(239, 255, 232, 0.92), rgba(228, 253, 244, 0.9));
  box-shadow: 0 12px 24px rgba(82, 199, 22, 0.12);
}

.product-form-grid .unit-field input {
  color: #0a7f2e;
  font-size: 1.16rem;
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(82, 199, 22, 0.42);
}

.product-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.product-inventory-panel {
  margin-top: 14px;
  border: 1px solid rgba(0, 147, 221, 0.14);
  border-radius: 14px;
  padding: 12px;
  background:
    radial-gradient(circle at 100% 0, rgba(0, 147, 221, 0.08), transparent 12rem),
    linear-gradient(135deg, rgba(248, 255, 246, 0.9), rgba(231, 250, 255, 0.76));
}

.inventory-mini-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.inventory-mini-head span {
  display: block;
  color: var(--green-dark);
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.inventory-mini-head small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-align: right;
}

.inventory-total-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
}

.inventory-total-strip b {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  gap: 6px;
  min-height: 31px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 1rem;
  font-weight: 950;
  line-height: 1;
}

.inventory-total-strip small {
  color: inherit;
  font-size: 0.58rem;
  font-weight: 950;
  letter-spacing: 0.04em;
  opacity: 0.78;
  text-align: left;
  text-transform: uppercase;
}

.inventory-total-strip .full {
  color: #075f94;
  border: 1px solid rgba(0, 147, 221, 0.24);
  background: linear-gradient(135deg, rgba(231, 250, 255, 0.96), rgba(255, 255, 255, 0.8));
}

.inventory-total-strip .balance {
  color: #15803d;
  border: 1px solid rgba(82, 199, 22, 0.28);
  background: linear-gradient(135deg, rgba(239, 255, 232, 0.96), rgba(228, 253, 244, 0.8));
}

.inventory-total-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  margin: -2px 0 10px;
  background: linear-gradient(90deg, rgba(0, 147, 221, 0.13), rgba(82, 199, 22, 0.13));
}

.inventory-total-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #00a3df, #52c716);
  box-shadow: 0 0 12px rgba(82, 199, 22, 0.28);
}

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

.inventory-location {
  display: grid;
  gap: 8px;
  min-height: 96px;
  border: 1px solid rgba(82, 199, 22, 0.2);
  border-radius: 13px;
  padding: 9px;
  background: rgba(255, 255, 255, 0.78);
}

.inventory-location span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.inventory-location strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: clamp(0.98rem, 1.45vw, 1.18rem);
  font-weight: 950;
}

.inventory-mini-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-top: 6px;
}

.inventory-mini-stats b {
  display: grid;
  gap: 1px;
  min-width: 0;
  border: 1px solid rgba(82, 199, 22, 0.15);
  border-radius: 7px;
  padding: 4px 3px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 950;
  line-height: 1.05;
  text-align: center;
}

.inventory-mini-stats small {
  color: var(--muted);
  font-size: 0.52rem;
  font-weight: 950;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.inventory-location.blue {
  border-color: rgba(0, 147, 221, 0.24);
  background: linear-gradient(135deg, rgba(231, 250, 255, 0.86), rgba(255, 255, 255, 0.82));
}

.inventory-location.amber {
  border-color: rgba(245, 158, 11, 0.24);
  background: linear-gradient(135deg, rgba(255, 251, 235, 0.9), rgba(255, 255, 255, 0.8));
}

.inventory-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(82, 199, 22, 0.13);
}

.inventory-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #52c716, #21c6a8);
}

.inventory-location.blue .inventory-track i {
  background: linear-gradient(90deg, #00a3df, #21c6a8);
}

.inventory-location.amber .inventory-track i {
  background: linear-gradient(90deg, #f59e0b, #52c716);
}

.inventory-age-bar {
  display: grid;
  grid-template-columns: minmax(150px, auto) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin: 0 0 10px;
  padding: 9px 10px;
  border: 1px solid rgba(239, 68, 68, 0.18);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 241, 242, 0.82), rgba(255, 251, 235, 0.76), rgba(239, 255, 232, 0.7));
}

.inventory-age-copy {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
  white-space: nowrap;
}

.inventory-age-copy span {
  color: #b91c1c;
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.inventory-age-copy strong {
  color: #991b1b;
  font-size: 0.95rem;
  font-weight: 950;
}

.inventory-age-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  text-overflow: ellipsis;
}

.inventory-age-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.1);
}

.inventory-age-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ef4444, #f59e0b, #52c716);
}

.similar-products {
  min-width: 0;
  border: 1px solid rgba(0, 147, 221, 0.16);
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(135deg, rgba(231, 250, 255, 0.78), rgba(248, 255, 246, 0.82));
}

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

.similar-head strong {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 28px;
  border-radius: 999px;
  background: #e8fbff;
  color: #0676b8;
  font-size: 0.82rem;
  font-weight: 950;
}

.invoice-card {
  overflow: hidden;
}

.billing-card {
  margin-top: 14px;
  overflow: hidden;
}

.history-card {
  margin-top: 14px;
  padding: 14px;
}

.invoice-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(231, 250, 255, 0.9), rgba(241, 255, 232, 0.8));
}

.invoice-head h2 {
  margin-top: 4px;
  font-size: 1.45rem;
}

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

.invoice-numbers label {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 950;
  text-transform: uppercase;
}

.invoice-numbers input {
  padding: 8px;
  font-size: 0.78rem;
}

.billing-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
  gap: 14px;
  align-items: start;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 100% 0, rgba(0, 147, 221, 0.12), transparent 18rem),
    linear-gradient(135deg, rgba(241, 255, 232, 0.9), rgba(231, 250, 255, 0.8));
}

.billing-head span,
.bill-summary span {
  color: var(--green-dark);
  font-size: 0.74rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.billing-head h2 {
  margin-top: 4px;
  font-size: 1.45rem;
}

.billing-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.billing-tools {
  display: grid;
  gap: 8px;
}

.branch-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.branch-tabs button {
  min-height: 38px;
  background: rgba(255, 255, 255, 0.72);
  color: #143524;
  box-shadow: none;
}

.branch-tabs button.active {
  background: linear-gradient(135deg, #52c716, #00b4d8);
  color: #031b13;
  box-shadow: 0 12px 26px rgba(82, 199, 22, 0.16);
}

.bill-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(16, 32, 25, 0.08);
  background: rgba(248, 255, 246, 0.72);
}

.bill-summary article {
  min-width: 0;
  border: 1px solid rgba(82, 199, 22, 0.18);
  border-radius: 14px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.82);
}

.bill-summary strong {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  color: #075f94;
  font-size: 1.08rem;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bill-history {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(16, 32, 25, 0.08);
  background: rgba(255, 255, 255, 0.72);
}

.bill-history div {
  min-width: 0;
  border-left: 3px solid rgba(0, 147, 221, 0.38);
  padding: 4px 0 4px 9px;
}

.bill-history span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.bill-history strong {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  font-size: 0.96rem;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.billing-table-wrap {
  max-height: 430px;
  min-height: 260px;
  overflow: auto;
}

.bill-qty-input {
  min-width: 88px;
  padding: 7px 8px;
  border-radius: 9px;
  font-size: 0.78rem;
}

.bill-row-muted {
  opacity: 0.62;
}

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

.history-head span,
.history-row span,
.history-row small {
  color: var(--green-dark);
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.history-head h2 {
  margin-top: 3px;
  font-size: 1.3rem;
}

.invoice-history-list {
  display: grid;
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 4px;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(82, 199, 22, 0.18);
  border-radius: 14px;
  padding: 10px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(240, 255, 232, 0.72));
}

.history-row strong {
  display: block;
  font-weight: 950;
}

.history-row span {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: var(--muted);
  letter-spacing: 0;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}

.history-row small {
  display: block;
  margin-top: 5px;
  color: #075f94;
}

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

.history-actions button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 0.78rem;
}

.table-wrap {
  max-height: calc(100vh - 380px);
  min-height: 360px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.86rem;
}

th,
td {
  border-bottom: 1px solid rgba(16, 32, 25, 0.08);
  padding: 9px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f2fbef;
  color: #294838;
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.num {
  text-align: right;
  white-space: nowrap;
}

.item-img {
  width: 52px;
  height: 52px;
  border: 1px solid rgba(82, 199, 22, 0.22);
  border-radius: 10px;
  object-fit: cover;
  background: #fff;
}

.img-placeholder,
.empty-cell {
  color: var(--muted);
  font-weight: 900;
  text-align: center;
}

.sku-cell strong,
.desc-cell strong {
  display: block;
  font-weight: 950;
}

.sku-cell span,
.desc-cell span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.posting-panel {
  display: grid;
  gap: 10px;
}

.posting-card {
  display: grid;
  gap: 5px;
  min-height: 92px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(240, 255, 232, 0.78));
}

.posting-card.primary {
  border-color: rgba(0, 147, 221, 0.34);
  background: linear-gradient(135deg, #e7fbff, #edffe8);
}

.posting-card.balance {
  border-color: rgba(82, 199, 22, 0.34);
}

.posting-card strong {
  color: #075f94;
  font-size: 1.35rem;
  font-weight: 950;
}

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

.posting-actions button {
  min-width: 156px;
}

.status {
  min-height: 46px;
  padding: 10px;
  border: 1px solid rgba(0, 147, 221, 0.18);
  border-radius: 12px;
  background: rgba(231, 250, 255, 0.76);
}

.status.success {
  border-color: rgba(82, 199, 22, 0.34);
  background: rgba(239, 255, 232, 0.9);
  color: #1d6810;
}

.status.error {
  border-color: rgba(239, 68, 68, 0.28);
  background: rgba(255, 241, 242, 0.9);
  color: #991b1b;
}

.print-invoice {
  display: none;
}

.print-page {
  color: #102019;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.print-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: 3px solid #52c716;
}

.print-header img {
  width: 168px;
  height: auto;
  object-fit: contain;
}

.print-header p,
.print-meta span,
.print-totals span,
.print-footer span {
  color: #238111;
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.print-header h1 {
  margin-top: 6px;
  font-size: 2rem;
  line-height: 1;
}

.print-header aside {
  display: grid;
  gap: 6px;
  min-width: 180px;
  border: 2px solid #52c716;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}

.print-header aside strong {
  color: #075f94;
  font-size: 1.35rem;
  font-weight: 950;
}

.print-header aside span {
  font-weight: 950;
}

.print-qr-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 14px;
  align-items: center;
  margin: 14px 0 6px;
  border: 1px solid rgba(18, 58, 41, 0.16);
  border-radius: 10px;
  padding: 10px;
  background: #fbfff8;
}

.print-qr-band span {
  color: #238111;
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.print-qr-band strong {
  display: block;
  margin-top: 3px;
  font-weight: 950;
}

.print-qr-band small {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 4px;
  color: #65736d;
  font-size: 0.58rem;
  line-height: 1.25;
}

.print-qr-band img {
  width: 96px;
  height: 96px;
  border: 1px solid rgba(18, 58, 41, 0.18);
  border-radius: 8px;
  background: #fff;
}

.print-totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.print-totals div {
  border: 1px solid rgba(18, 58, 41, 0.16);
  border-radius: 10px;
  padding: 10px;
}

.print-totals strong {
  display: block;
  margin-top: 4px;
  font-size: 1rem;
  font-weight: 950;
}

.print-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
  margin: 12px 0 14px;
  border: 1px solid rgba(18, 58, 41, 0.18);
  border-left: 5px solid #52c716;
  border-radius: 10px;
  padding: 8px 12px;
  background: linear-gradient(135deg, #fbfff8, #f4fff0);
}

.print-meta div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-height: 27px;
  border-bottom: 1px solid rgba(18, 58, 41, 0.1);
}

.print-meta div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.print-meta strong {
  min-width: 0;
  color: #102019;
  font-size: 0.88rem;
  font-weight: 950;
  text-align: right;
}

.print-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.print-table th {
  position: static;
  border-bottom: 2px solid #102019;
  background: #f2fbef;
  color: #102019;
  padding: 8px;
}

.print-table td {
  border-bottom: 1px solid rgba(16, 32, 25, 0.16);
  padding: 8px;
}

.print-table td span {
  color: #65736d;
  font-size: 0.74rem;
  font-weight: 800;
}

.print-totals {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-left: auto;
  width: min(520px, 100%);
}

.print-footer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  margin-top: 46px;
}

.print-footer div {
  min-height: 54px;
  border-top: 1px solid #102019;
  padding-top: 8px;
}

.print-verification {
  margin-top: 22px;
}

.security-check-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.55fr);
  gap: 12px;
  align-items: end;
  border: 1.5px solid rgba(18, 58, 41, 0.22);
  border-left: 5px solid #238111;
  border-radius: 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #fbfff8, #efffed);
}

.security-check-card span {
  color: #238111;
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.security-check-card strong {
  display: block;
  margin-top: 4px;
  font-size: 1rem;
  font-weight: 950;
}

.security-check-card small {
  display: block;
  min-height: 34px;
  border-bottom: 1px solid #102019;
  color: #65736d;
  font-size: 0.72rem;
  font-weight: 850;
  text-align: right;
}

.invoice-data-mode {
  background: linear-gradient(135deg, #f8fff3 0%, #eefbf5 48%, #f7fff9 100%);
}

.invoice-data-mode .inventory-shell {
  display: none;
}

.invoice-data-mode .print-invoice {
  display: block;
  width: min(980px, calc(100% - 28px));
  margin: 22px auto;
}

.invoice-data-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.invoice-data-card header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.invoice-data-card header img {
  width: 160px;
  max-width: 38vw;
}

.invoice-data-card span,
.invoice-data-summary span {
  color: var(--green-dark);
  font-size: 0.74rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.invoice-data-card h1 {
  margin-top: 3px;
  font-size: clamp(1.5rem, 4vw, 2.4rem);
}

.invoice-data-card p {
  margin-top: 5px;
  color: var(--muted);
  font-weight: 800;
}

.invoice-data-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.invoice-data-summary article {
  border: 1px solid rgba(82, 199, 22, 0.18);
  border-radius: 14px;
  padding: 12px;
}

.invoice-data-summary strong {
  display: block;
  margin-top: 4px;
  color: #075f94;
  font-size: 1.2rem;
  font-weight: 950;
}

.invoice-data-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

#invoiceCsvText {
  width: 100%;
  min-height: 52vh;
  border: 1px solid rgba(18, 58, 41, 0.16);
  border-radius: 14px;
  padding: 12px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  resize: vertical;
}

@media (max-width: 1180px) {
  .app-grid {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .product-layout {
    grid-template-columns: minmax(220px, 0.9fr) minmax(320px, 1.2fr);
  }

  .similar-products {
    grid-column: 1 / -1;
  }
}

@media (max-width: 840px) {
  .inventory-shell {
    width: min(100% - 18px, 720px);
  }

  .inventory-hero,
  .brand-lockup,
  .invoice-head,
  .billing-head,
  .product-head,
  .product-layout {
    display: grid;
  }

  .brand-lockup img {
    width: 150px;
    max-width: 72vw;
  }

  .brand-lockup h1 {
    font-size: clamp(1.7rem, 9vw, 2.6rem);
  }

  .control-strip,
  .app-grid,
  .top-action-bar,
  .workflow,
  .product-layout,
  .product-form-grid,
  .inventory-location-grid,
  .summary-grid,
  .invoice-numbers,
  .bill-summary,
  .bill-history,
  .invoice-data-summary {
    grid-template-columns: 1fr;
  }

  .invoice-data-card header {
    display: grid;
  }

  .inventory-age-bar {
    grid-template-columns: 1fr;
    border-radius: 14px;
  }

  .inventory-age-copy {
    justify-content: space-between;
  }

  .inventory-hero,
  .control-strip,
  .top-action-bar,
  .side-panel {
    position: static;
  }

  .container-list {
    max-height: 280px;
  }

  .table-wrap {
    max-height: 62vh;
  }

  .billing-table-wrap {
    max-height: 58vh;
  }

  .history-head,
  .history-row,
  .history-actions {
    display: grid;
  }
}

@media print {
  @page {
    size: A4;
    margin: 12mm;
  }

  body {
    background: #fff;
  }

  body.printing-branch-invoice .inventory-shell {
    display: none !important;
  }

  body.printing-branch-invoice .print-invoice {
    display: block !important;
  }

  .hero-actions,
  .control-strip,
  .side-panel,
  .posting-actions,
  .status,
  .branch-tabs,
  #billSearch {
    display: none !important;
  }

  .inventory-shell {
    width: 100%;
    padding: 0;
  }

  .inventory-hero,
  .invoice-card,
  .billing-card,
  .history-card,
  .posting-panel,
  .summary-grid article {
    box-shadow: none;
  }

  .app-grid {
    display: block;
  }

  .table-wrap {
    max-height: none;
    overflow: visible;
  }
}
