:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-2: #eef4f2;
  --ink: #101820;
  --muted: #60707b;
  --line: #dbe5e2;
  --primary: #14735f;
  --primary-dark: #0e5547;
  --accent: #f2c94c;
  --danger: #a93642;
  --danger-2: #ffe9ec;
  --warning: #9a5a08;
  --warning-2: #fff3d9;
  --shadow: 0 14px 34px rgba(15, 35, 45, 0.11);
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.demo-shell {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 14px 10px;
  color: #f8fbfc;
  background: #18232d;
}

.brand {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 52px;
}

.brand span {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  color: #17212b;
  background: var(--accent);
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: #aab5bd;
}

.nav {
  display: grid;
  gap: 5px;
}

.nav-item {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 9px;
  min-height: 39px;
  border: 0;
  border-radius: 7px;
  padding: 0 10px;
  color: #dce6ea;
  background: transparent;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  color: #fff;
  background: #263645;
}

.demo-note {
  display: grid;
  gap: 5px;
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(220, 227, 231, 0.18);
  border-radius: 8px;
  background: #22313f;
}

.demo-note span {
  color: #b9c8d0;
  font-size: 12px;
  line-height: 1.4;
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.topbar h1 {
  margin: 0 0 3px;
  font-size: 21px;
}

.topbar p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.top-actions,
.row-actions,
.sale-actions,
.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.primary,
.secondary,
.danger,
.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  border-radius: 7px;
  border: 1px solid transparent;
  padding: 0 12px;
  font-weight: 900;
  white-space: nowrap;
}

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

.primary:hover {
  background: var(--primary-dark);
}

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

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

.ghost {
  color: var(--muted);
  background: transparent;
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.workspace {
  padding: 18px;
}

.sale-view {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(370px, 0.75fr);
  gap: 16px;
  align-items: start;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2 {
  margin: 0;
  font-size: 17px;
}

.panel-body {
  padding: 14px;
}

.barcode-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 12px;
}

input,
select {
  width: 100%;
  min-height: 39px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
}

.category-tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  margin-bottom: 12px;
}

.category-tabs button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  color: var(--muted);
  background: #fff;
  font-weight: 900;
  white-space: nowrap;
}

.category-tabs button.active {
  color: var(--primary);
  border-color: #aad8cd;
  background: #e3f4ef;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 9px;
}

.product-card {
  display: grid;
  gap: 6px;
  min-height: 126px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  text-align: left;
}

.product-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px #e3f4ef;
}

.product-card strong,
.product-card small,
.product-card span {
  display: block;
}

.product-card small {
  color: var(--muted);
}

.product-card span {
  margin-top: auto;
  color: var(--primary);
  font-size: 18px;
  font-weight: 900;
}

.stock-pill,
.pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 900;
}

.stock-pill.ok,
.pill.ok {
  color: var(--primary);
  background: #e3f4ef;
}

.stock-pill.low,
.pill.low {
  color: var(--warning);
  background: var(--warning-2);
}

.cart-lines {
  display: grid;
  gap: 8px;
}

.cart-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 94px 84px 34px;
  align-items: center;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.cart-line strong,
.cart-line small {
  display: block;
}

.cart-line small {
  margin-top: 2px;
  color: var(--muted);
}

.qty {
  display: grid;
  grid-template-columns: 28px 1fr 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}

.qty button {
  min-height: 30px;
  border: 0;
  background: var(--surface-2);
  font-weight: 900;
}

.qty span {
  display: grid;
  place-items: center;
  font-weight: 900;
}

.line-total {
  text-align: right;
  font-weight: 900;
}

.remove {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 7px;
  color: var(--danger);
  background: var(--danger-2);
}

.empty {
  display: grid;
  place-items: center;
  min-height: 120px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.totals {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.totals div {
  display: flex;
  justify-content: space-between;
}

.totals .grand {
  font-size: 23px;
  font-weight: 900;
}

.payment-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.data-table th {
  color: var(--muted);
  font-size: 12px;
}

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

.stat {
  display: grid;
  gap: 6px;
  min-height: 94px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fff;
}

.stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

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

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
}

.toast-item {
  min-width: 230px;
  border-radius: 8px;
  padding: 11px 12px;
  color: #fff;
  background: #18232d;
  box-shadow: var(--shadow);
}

@media (max-width: 980px) {
  .demo-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .sale-view,
  .stat-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .topbar,
  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .cart-line,
  .payment-box,
  .barcode-box {
    grid-template-columns: 1fr;
  }

  .line-total {
    text-align: left;
  }
}
