:root {
  --bg: #0e1410;
  --panel: #161d18;
  --panel2: #1c2620;
  --border: #2c3a30;
  --text: #f2f5f0;
  --muted: #9aab9f;
  --green: #2d8a45;
  --green-d: #1e5c30;
  --gold: #e0b33a;
  --danger: #e85d5d;
  --radius: 14px;
  font-family: "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }
.block { width: 100%; }
.err { color: var(--danger); min-height: 1.2rem; }
.msg { min-height: 1.3rem; font-weight: 600; margin: 8px 0 0; }
.msg.ok { color: #6ddea0; }
.msg.bad { color: var(--danger); }

/* Login */
.login-screen {
  min-height: 100%; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(800px 400px at 10% 0%, #1a3d28 0%, transparent 55%),
    var(--bg);
}
.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px 22px;
}
.badge {
  display: inline-block; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--gold); margin: 0 0 8px;
}
.login-card h1 { margin: 0 0 6px; font-size: 1.6rem; }
.sub { color: var(--muted); margin: 0 0 16px; font-size: 0.95rem; }
.login-card label, .checkout label {
  display: block; font-weight: 600; font-size: 0.88rem; margin: 0 0 10px;
}
.login-card input, .login-card select,
.checkout input, .top select, .search-row input {
  display: block; width: 100%; margin-top: 4px;
  padding: 0.75rem 0.85rem; border-radius: 10px;
  border: 1px solid var(--border); background: #0c100e; color: var(--text);
  font-size: 1.05rem;
}
.hint { font-size: 0.88rem; color: var(--muted); margin: 14px 0 0; }
.hint a { color: #8fd49c; }

.btn {
  border: 1px solid var(--border); background: #243428; color: var(--text);
  border-radius: 12px; padding: 0.7rem 1rem; font-size: 1rem; font-weight: 700;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center;
  justify-content: center; gap: 6px;
}
.btn:hover { filter: brightness(1.08); }
.btn.primary { background: var(--green); border-color: transparent; color: #fff; }
.btn.ghost { background: transparent; }
.btn.pay { font-size: 1.15rem; padding: 1rem; margin-top: 8px; }

/* Till shell */
.till { height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.top {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--border); background: #121814;
}
.brand strong { display: block; font-size: 1.15rem; }
.brand .muted { font-size: 0.85rem; }
.top-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.inline select { display: inline-block; width: auto; min-width: 7rem; margin: 0 0 0 6px; padding: 0.45rem 0.6rem; }

.layout {
  flex: 1; display: grid; grid-template-columns: 1fr minmax(320px, 380px);
  min-height: 0; overflow: hidden;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .cart-panel { max-height: 48vh; border-left: none; border-top: 1px solid var(--border); }
}

.catalogue {
  display: flex; flex-direction: column; min-height: 0; padding: 12px 12px 8px;
}
.search-row { display: flex; gap: 8px; margin-bottom: 10px; }
.search-row input { flex: 1; font-size: 1.1rem; }
.cats {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; max-height: 72px; overflow: auto;
}
.cat {
  border: 1px solid var(--border); background: var(--panel2); color: var(--muted);
  border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: 0.82rem; cursor: pointer;
}
.cat.active { background: var(--green-d); color: #fff; border-color: var(--green); }

.grid {
  flex: 1; overflow: auto; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px; align-content: start; padding-bottom: 12px;
}
.prod {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 12px 10px; cursor: pointer; text-align: left; color: inherit;
  min-height: 110px; display: flex; flex-direction: column; gap: 4px;
  transition: border-color 0.12s, transform 0.1s;
}
.prod:hover { border-color: rgba(45,138,69,0.65); transform: translateY(-1px); }
.prod:active { transform: scale(0.98); }
.prod .t { font-weight: 700; font-size: 0.95rem; line-height: 1.25; flex: 1; }
.prod .p { color: var(--gold); font-weight: 800; font-size: 1.05rem; }
.prod .q { font-size: 0.78rem; color: var(--muted); }
.prod.low .q { color: #f0c14b; }
.prod.out { opacity: 0.45; cursor: not-allowed; }

.cart-panel {
  background: var(--panel); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0; padding: 12px 14px 14px;
}
.cart-panel h2 { margin: 0 0 8px; font-size: 1.15rem; }
.cart-lines { flex: 1; overflow: auto; min-height: 80px; }
.cart-line {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 8px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.cart-line .title { font-weight: 700; font-size: 0.95rem; }
.cart-line .meta { font-size: 0.82rem; color: var(--muted); }
.cart-line .price { font-weight: 800; color: var(--gold); text-align: right; }
.qty-ctrl { display: flex; gap: 6px; align-items: center; }
.qty-ctrl button {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border);
  background: #243428; color: var(--text); font-size: 1.2rem; font-weight: 700; cursor: pointer;
}
.qty-ctrl span { min-width: 1.5rem; text-align: center; font-weight: 800; }

.totals { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 6px; }
.totals .row { display: flex; justify-content: space-between; margin: 4px 0; color: var(--muted); }
.totals .total { color: var(--text); font-size: 1.25rem; margin-top: 6px; }
.checkout { margin-top: 10px; }
.tender-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin: 8px 0; }
.tender {
  border: 1px solid var(--border); background: #1a221c; color: var(--muted);
  border-radius: 10px; padding: 0.65rem; font-weight: 800; cursor: pointer;
}
.tender.active { background: var(--green-d); color: #fff; border-color: var(--green); }
