:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --success: #16a34a;
  --warning: #f97316;
  --shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', Arial, Helvetica, sans-serif;
  overscroll-behavior: none;
  touch-action: manipulation;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app {
  display: grid;
  grid-template-rows: auto auto minmax(180px, 1fr) auto;
  gap: 12px;
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 12px;
}

.top-bar {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 52px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 6px 8px 6px 14px;
}

.logo-space {
  min-height: 36px;
}

.menu-button {
  /*display: inline-grid;*/
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: transparent;
}

.menu-button:active {
  background: rgba(17, 24, 39, 0.06);
}

.menu-button span,
.menu-button::before,
.menu-button::after {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 99px;
  background: var(--text);
  content: '';
}

.menu-button span {
  margin: 5px 0;
}

.menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 8px;
  z-index: 10;
  display: none;
  min-width: 180px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 16px 35px rgba(15, 23, 42, 0.16);
  padding: 8px;
}

.menu-panel.is-open {
  display: block;
}

.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  border-radius: 10px;
  background: #f8fafc;
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.menu-item + .menu-item {
  margin-top: 6px;
}

.menu-item.is-active {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: var(--primary-dark);
}

.menu-user {
  margin-bottom: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.role-tag {
  display: inline-block;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  padding: 1px 8px;
  font-size: 10px;
  text-transform: uppercase;
}

.menu-logout {
  margin-top: 6px;
  color: var(--danger);
}

.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 24px 20px;
}

.auth-title {
  margin: 0;
  text-align: center;
  font-size: 24px;
  font-weight: 800;
  color: var(--primary-dark);
}

.auth-subtitle {
  margin: 4px 0 18px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-error {
  margin: 0 0 12px;
  border-radius: 10px;
  background: #fef2f2;
  color: #b91c1c;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.menu-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--warning);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 0 6px;
}

.section {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.section-header h1,
.section-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
  line-height: 1.2;
}

.badge {
  border-radius: 999px;
  background: #eff6ff;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 9px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  max-height: 252px;
  overflow-y: auto;
  padding: 10px;
}

.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 78px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
  color: var(--text);
  padding: 10px 6px;
  text-align: center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.product-card:active {
  transform: scale(0.97);
}

.product-card.is-selected {
  border-color: var(--primary);
  background: linear-gradient(160deg, #eff6ff, #dbeafe);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.18);
}

.product-qty-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  display: none;
  place-items: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  line-height: 22px;
  padding: 0 6px;
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.32);
}

.product-card.is-selected .product-qty-badge {
  display: grid;
}

.product-name {
  display: -webkit-box;
  min-height: 30px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.product-price {
  margin-top: 6px;
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 700;
}

.cart-list {
  max-height: 33vh;
  overflow-y: auto;
  padding: 10px;
}

.empty-cart {
  margin: 0;
  padding: 24px 8px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.cart-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.cart-item:last-child {
  border-bottom: 0;
}

.cart-name {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
}

.cart-price {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.cart-subtotal {
  margin: 6px 0 0;
  font-size: 13px;
  font-weight: 700;
}

.cart-actions {
  display: grid;
  grid-template-columns: 30px 34px 30px;
  align-items: center;
  gap: 6px;
  justify-items: center;
}

.qty-btn,
.delete-btn {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  color: #ffffff;
  font-weight: 800;
}

.qty-btn {
  background: linear-gradient(135deg, #2563eb, #38bdf8);
}

.delete-btn {
  grid-column: 1 / -1;
  width: 100%;
  background: linear-gradient(135deg, #dc2626, #fb7185);
  font-size: 12px;
}

.qty-value {
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.payment-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.summary-row strong {
  color: var(--text);
  font-size: 18px;
}

.total-row {
  border: 1px solid #dbeafe;
  border-radius: 14px;
  background: linear-gradient(135deg, #f0f7ff, #eef2ff);
  padding: 12px 14px;
}

.total-row span {
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  font-size: 12px;
}

.total-row strong {
  color: var(--primary-dark);
  font-size: 20px;
}

.payment-methods {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.method-option input {
  display: none;
}

.method-label {
  display: block;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f9fafb;
  padding: 10px 6px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.method-option input:checked + .method-label {
  border-color: var(--primary);
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: var(--primary-dark);
}

.cash-panel {
  display: none;
  gap: 8px;
}

.cash-panel.is-visible {
  display: grid;
}

.cash-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  font-size: 16px;
  font-weight: 700;
  outline: none;
}

.cash-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.quick-cash {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.quick-cash button {
  border-radius: 12px;
  background: linear-gradient(135deg, #eef2ff, #dbeafe);
  color: var(--primary-dark);
  padding: 10px 4px;
  font-size: 12px;
  font-weight: 800;
}

.change-row {
  color: var(--success);
  font-weight: 800;
}

.change-row.is-negative {
  color: var(--warning);
}

.action-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.primary-btn,
.secondary-btn {
  border-radius: 14px;
  padding: 10px;
  color: #ffffff;
  font-weight: 800;
}

.primary-btn {
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.24);
}

.primary-btn:disabled {
  background: linear-gradient(135deg, #93c5fd, #bae6fd);
  cursor: not-allowed;
  box-shadow: none;
}

.secondary-btn {
  background: linear-gradient(135deg, #dc2626, #f97316);
  box-shadow: 0 10px 18px rgba(220, 38, 38, 0.18);
}

.app--list {
  grid-template-rows: auto auto;
  align-content: start;
}

.filter-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.filter-field {
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.filter-field input {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  outline: none;
}

.filter-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.filter-submit {
  grid-column: 1 / -1;
}

.list-total {
  margin: 12px;
}

.tx-list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.tx-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
  padding: 12px;
  box-shadow: var(--shadow);
}

.tx-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.tx-code {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 14px;
  font-weight: 800;
}

.tx-caret {
  display: inline-block;
  color: var(--primary);
  font-size: 18px;
  line-height: 1;
  transition: transform 0.15s ease;
}

.tx-card.detail-open .tx-caret {
  transform: rotate(90deg);
}

.tx-items {
  display: none;
}

.tx-card.detail-open .tx-items {
  display: grid;
}

.tx-time {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.method-pill {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 800;
  background: #eff6ff;
  color: var(--primary-dark);
}

.method-tunai {
  background: #ecfdf5;
  color: #047857;
}

.method-transfer {
  background: #fef3c7;
  color: #b45309;
}

.tx-items {
  list-style: none;
  margin: 10px 0;
  padding: 10px 0;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
  gap: 4px;
}

.tx-items li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.tx-items li span:last-child {
  color: var(--muted);
  font-weight: 700;
}

.tx-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tx-foot strong {
  font-size: 14px;
}

.btn-danger-sm {
  border-radius: 10px;
  background: linear-gradient(135deg, #dc2626, #f97316);
  color: #ffffff;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 800;
}

.pending-note {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.tx-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-soft-sm {
  border-radius: 10px;
  background: linear-gradient(135deg, #eef2ff, #dbeafe);
  color: var(--primary-dark);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 800;
}

.pending-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 2px;
  background: transparent;
  color: var(--primary-dark);
  padding: 6px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: underline;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
}

.overlay[hidden] {
  display: none;
}

.overlay-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 22px 22px 0 0;
  background: var(--card);
  box-shadow: 0 -10px 30px rgba(15, 23, 42, 0.25);
}

.overlay-close {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: #f1f5f9;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}

.item-toolbar {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.item-form {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.item-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.item-active-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.item-active-toggle input {
  width: 18px;
  height: 18px;
}

.item-form-actions {
  grid-template-columns: 1fr auto;
}

.item-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
  padding: 12px;
  box-shadow: var(--shadow);
}

.profile-card {
  margin-bottom: 16px;
}

.item-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-pill {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 800;
}

.status-on {
  background: #ecfdf5;
  color: #047857;
}

.status-off {
  background: #fef2f2;
  color: #b91c1c;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
}

.page-btn {
  border-radius: 10px;
  background: linear-gradient(135deg, #eef2ff, #dbeafe);
  color: var(--primary-dark);
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.page-btn.is-disabled {
  background: #f1f5f9;
  color: var(--muted);
  pointer-events: none;
}

.page-info {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

@media (max-width: 360px) {
  .app {
    padding: 8px;
  }

  .product-grid {
    gap: 6px;
  }

  .product-card {
    padding-inline: 3px;
  }
}
