:root {
  --bg: #f4f1e8;
  --panel: #ffffff;
  --ink: #1f1a14;
  --muted: #6c5f52;
  --accent: #1b8c5a;
  --accent-dark: #146645;
  --cash: #2d9c5a;
  --card: #1f6fd1;
  --other: #c56b1f;
  --danger: #d1495b;
  --shadow: 0 12px 30px rgba(28, 22, 16, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Gill Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #f7e8d6 0%, #f4f1e8 40%, #ece5d6 100%);
  min-height: 100vh;
}

h2 {
  margin: 0 0 12px 0;
  font-size: 1.4rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  background: #fff;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand-title {
  font-size: 1.8rem;
  font-weight: 700;
}

.brand-sub {
  color: var(--muted);
  font-size: 0.95rem;
}

.nav {
  display: flex;
  gap: 14px;
}

.nav-link {
  text-decoration: none;
  padding: 12px 18px;
  border-radius: 999px;
  background: #efe7d9;
  color: var(--ink);
  font-weight: 600;
  transition: transform 0.1s ease;
}

.nav-link.active {
  background: var(--accent);
  color: #fff;
}

.nav-link:active {
  transform: scale(0.98);
}

.pos-main {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 1fr;
  gap: 22px;
  padding: 24px 28px 40px;
}

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

.selected-lot {
  font-weight: 700;
  color: var(--accent-dark);
}

.lot-panel,
.entry-panel,
.cart-panel {
  background: var(--panel);
  padding: 18px;
  border-radius: 22px;
  box-shadow: var(--shadow);
  min-height: 560px;
}

.lot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}

.lot-btn {
  border: none;
  border-radius: 18px;
  padding: 20px 16px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  min-height: 100px;
  cursor: pointer;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.15);
}

.lot-btn.selected {
  outline: 4px solid #222;
}

.entry-display {
  font-size: 2.2rem;
  text-align: right;
  background: #f9f4eb;
  padding: 14px 18px;
  border-radius: 14px;
  border: 2px solid #e6dcc9;
  margin-bottom: 16px;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.key {
  font-size: 1.6rem;
  padding: 16px 0;
  border-radius: 14px;
  border: none;
  background: #efe7d9;
  cursor: pointer;
  font-weight: 700;
}

.key.action {
  background: #f6d9c1;
}

.btn {
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}

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

.btn.secondary {
  background: #efe7d9;
  color: var(--ink);
}

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

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

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

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.cart-lines {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 6px;
}

.note-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.note-field label {
  font-weight: 600;
  color: var(--muted);
}

.cart-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f9f4eb;
  padding: 12px 14px;
  border-radius: 12px;
}

.cart-line button {
  border: none;
  background: transparent;
  font-size: 1.1rem;
  color: var(--danger);
  cursor: pointer;
}

.cart-total {
  font-size: 1.8rem;
  font-weight: 700;
}

.finalize-buttons {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: #1f1a14;
  color: #fff;
  padding: 16px 22px;
  border-radius: 999px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(22, 18, 12, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 20;
}

.modal.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #fff;
  padding: 20px 24px;
  border-radius: 20px;
  width: min(520px, 92vw);
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.modal-close {
  border: none;
  background: #efe7d9;
  color: var(--ink);
  border-radius: 999px;
  width: 40px;
  height: 40px;
  font-size: 1.4rem;
  cursor: pointer;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cash-quick {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 10px;
}

.cash-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.cash-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f9f4eb;
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 600;
}

.cash-value {
  font-size: 1.4rem;
  font-weight: 700;
}

.cash-warning {
  color: var(--danger);
  font-weight: 600;
  min-height: 20px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

.admin-main,
.report-main {
  padding: 24px 28px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--panel);
  padding: 20px 24px;
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.form-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

input[type="text"],
input[type="number"],
input[type="date"] {
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid #e6dcc9;
  font-size: 1rem;
  width: 100%;
}

input[type="color"] {
  padding: 0;
  border-radius: 12px;
  border: 2px solid #e6dcc9;
  width: 52px;
  height: 48px;
  background: #fff;
}

.color-field {
  display: flex;
  gap: 8px;
  align-items: center;
}

.color-field input[type="text"] {
  flex: 1;
}

.table {
  display: grid;
  gap: 10px;
}

.table-row {
  display: grid;
  grid-template-columns: 0.85fr 1fr 1.1fr 1.3fr auto;
  gap: 10px;
  background: #f9f4eb;
  padding: 12px;
  border-radius: 14px;
  align-items: center;
}

.table-row.header {
  background: transparent;
  font-weight: 700;
  color: var(--muted);
}

.table-row input {
  margin: 0;
}

.table-row .color-field {
  min-width: 0;
}

.hint {
  color: var(--muted);
  font-size: 0.95rem;
}

.report-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  justify-content: space-between;
}

.report-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.grand-total {
  margin-top: 16px;
  font-size: 1.4rem;
  font-weight: 700;
}

@media (max-width: 1100px) {
  .pos-main {
    grid-template-columns: 1fr;
  }

  .lot-panel,
  .entry-panel,
  .cart-panel {
    min-height: auto;
  }
}
