:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #6b7280;
  --line: #e5e9f2;
  --primary: #5d58e8;
  --primary-dark: #115e59;
  --accent: #f59e0b;
  --danger: #dc2626;
  --success: #16a34a;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.app-shell {
  display: flex;
  min-height: 100vh;
}



.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

.brand small {
  display: block;
  color: #9ca3af;
  font-size: 12px;
}




.grid {
  display: grid;
  gap: 18px;
}

.grid.stats {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.grid.two {
  grid-template-columns: minmax(0, 1fr) 360px;
}

.grid.sales-grid {
  grid-template-columns: minmax(420px, 1fr) minmax(460px, 520px);
}

.grid.stock-grid {
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  align-items: start;
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.card-header h2,
.card-header h3 {
  margin: 0;
  font-size: 18px;
}

.card-body {
  padding: 20px;
}

.stat {
  padding: 20px;
}

.stat span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(240px, 360px) auto;
  align-items: center;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 15px;
  border: 0;
  border-radius: 8px;
  background: #e5e7eb;
  color: #111827;
  font-weight: 750;
  cursor: pointer;
}

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

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

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

.btn.search {
  background: transparent;
  border: 1px solid var(--line);
}

.table-wrap {
  overflow-x: auto;
}

.stock-history-table {
  table-layout: fixed;
}

.stock-history-table th:nth-child(1),
.stock-history-table td:nth-child(1) {
  width: 92px;
}

.stock-history-table th:nth-child(3),
.stock-history-table td:nth-child(3),
.stock-history-table th:nth-child(4),
.stock-history-table td:nth-child(4),
.stock-history-table th:nth-child(5),
.stock-history-table td:nth-child(5) {
  width: 86px;
}

.stock-history-table td {
  overflow-wrap: anywhere;
}

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

.field {
  display: grid;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

label {
  color: #374151;
  font-size: 13px;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #d8dee9;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-size: 12px;
  font-weight: 800;
}

.badge.warn {
  background: #fffbeb;
  color: #b45309;
}

.badge.danger {
  background: #fef2f2;
  color: #b91c1c;
}

.flash {
  margin: 0 30px 6px;
  padding: 13px 16px;
  border-radius: 8px;
  background: #ecfdf5;
  color: #047857;
  font-weight: 700;
}

.flash.error {
  background: #fef2f2;
  color: #b91c1c;
}

.empty-state {
  padding: 36px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #fff;
  text-align: center;
}

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

.product-tile {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  text-align: left;
}

.product-tile:hover {
  border-color: var(--primary);
}

.product-tile strong {
  min-height: 40px;
}

.product-photo {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  object-fit: cover;
  background: #e5e7eb;
}

.logo-preview {
  width: 96px;
  height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
  padding: 8px;
}

.product-tile .product-photo {
  width: 100%;
  height: 118px;
}

.price-stack {
  display: grid;
  gap: 2px;
}

.price-stack del {
  color: var(--muted);
  font-size: 12px;
}

.cart-table th,
.cart-table td {
  padding: 11px 8px;
}

.cart-table input {
  min-width: 58px;
  padding-inline: 7px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 10px 0;
  color: #374151;
}

.summary-row.total {
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: #111827;
  font-size: 20px;
  font-weight: 850;
}

.receipt {
  width: 320px;
  margin: 24px auto;
  padding: 18px;
  background: #fff;
  color: #111;
  font-family: "Courier New", monospace;
}

.receipt h1,
.receipt p {
  margin: 0;
  text-align: center;
}

.receipt-logo {
  display: block;
  max-width: 72px;
  max-height: 72px;
  margin: 0 auto 8px;
  object-fit: contain;
}

.receipt h1 {
  font-size: 18px;
  line-height: 1.15;
}

.receipt p {
  font-size: 12px;
  line-height: 1.35;
}

.receipt hr {
  border: 0;
  border-top: 1px dashed #111;
  margin: 10px 0;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

@media (max-width: 980px) {
  .app-shell,
  .auth-page {
    display: block;
  }


  .grid.stats,
  .grid.two,
  .grid.sales-grid,
  .grid.stock-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .auth-visual {
    display: none;
  }
}

@media print {
  body {
    background: #fff;
  }

  .no-print,
  .sidebar,
  .topbar {
    display: none !important;
  }

  .receipt {
    width: 58mm;
    margin: 0;
    padding: 0;
    box-shadow: none;
  }
}
