/* Oloolua Hardware - mobile-first admin */
:root {
  --navy: #0f1f3d;       /* Oloolua deep navy (topbar, primary buttons) */
  --navy-dark: #0a1628;  /* logo background navy-black */
  --gold: #d4af37;       /* brand accent (metallic gold from the logo) */
  --gold-bright: #f0c64a;
  --maroon: #7a1e2b;     /* brand secondary (roof/H in the logo) */
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1d2733;
  --muted: #6b7a8c;
  --line: #e3e8ee;
  --red: #c0392b;
  --green: #1e8e5a;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
}
.hidden { display: none !important; }

/* ---- auth ---- */
.auth {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-dark) 100%);
  padding: 20px;
}
.auth-logo {
  width: 160px; max-width: 55%; height: auto; display: block;
  margin-bottom: 18px; border-radius: 18px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .45);
}
.auth-card {
  background: var(--card); border-radius: var(--radius);
  padding: 28px 22px; width: 100%; max-width: 380px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.auth-card h1 { font-size: 1.4rem; color: var(--navy); margin-bottom: 4px; }
.auth-sub { color: var(--muted); font-size: .9rem; margin-bottom: 18px; }
.auth-error { color: var(--red); font-size: .85rem; margin-top: 10px; min-height: 1.2em; }

/* ---- fields ---- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.field input, .field select {
  width: 100%; padding: 12px; font-size: 1rem;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.field input:focus, .field select:focus { outline: 2px solid var(--gold); border-color: transparent; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

/* ---- buttons ---- */
.btn {
  padding: 12px 18px; font-size: 1rem; font-weight: 600;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--text); cursor: pointer;
}
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:active { background: var(--navy-dark); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .55; }

/* ---- app shell ---- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--navy-dark); color: #fff;
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px;
}
.topbar-logo { height: 40px; width: auto; display: block; border-radius: 6px; }
.topbar-user { font-size: .82rem; opacity: .85; color: var(--gold); }

main {
  padding: 14px 14px 90px;
  max-width: 720px; margin: 0 auto;
}

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; padding: 12px 4px; font-size: .82rem; font-weight: 600;
  border: none; background: none; color: var(--muted); cursor: pointer;
  position: relative;
}
.tab.active { color: var(--navy); }
.tab.active::after {
  content: ""; position: absolute; top: 0; left: 25%; right: 25%;
  height: 3px; background: var(--gold); border-radius: 0 0 3px 3px;
}
.badge {
  position: absolute; top: 6px; right: 12%;
  background: var(--red); color: #fff; font-size: .68rem;
  min-width: 17px; height: 17px; line-height: 17px;
  border-radius: 9px; padding: 0 4px;
}

/* ---- lists & cards ---- */
.searchbar { display: flex; gap: 8px; margin-bottom: 12px; }
.searchbar input { flex: 1; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 1rem; }
.searchbar select { padding: 11px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: .9rem; max-width: 40%; }

.item-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 14px; margin-bottom: 9px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.item-main { min-width: 0; }
.item-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-sub { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.item-qty { text-align: right; flex-shrink: 0; }
.item-qty .n { font-weight: 700; font-size: 1.05rem; }
.item-qty .u { font-size: .75rem; color: var(--muted); }
.item-qty.low .n { color: var(--red); }
.price-tag { font-size: .85rem; color: var(--green); font-weight: 600; }

.empty { text-align: center; color: var(--muted); padding: 40px 10px; font-size: .95rem; }

.fab {
  position: fixed; right: 18px; bottom: 76px; z-index: 11;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--gold); color: var(--navy-dark);
  font-size: 1.9rem; font-weight: 700; line-height: 1;
  border: none; cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
}

/* ---- modal ---- */
.modal {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(15,25,38,.55);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-card {
  background: #fff; border-radius: 16px 16px 0 0;
  padding: 20px 18px 26px; width: 100%; max-width: 520px;
  max-height: 88vh; overflow-y: auto;
}
.modal-card h2 { font-size: 1.1rem; color: var(--navy); margin-bottom: 14px; }
.modal-actions { display: flex; gap: 10px; margin-top: 6px; }
.modal-actions .btn { flex: 1; }

@media (min-width: 600px) {
  .modal { align-items: center; }
  .modal-card { border-radius: 16px; }
}

/* ---- sell tab ---- */
.sell-results { margin-bottom: 12px; }
.sell-result {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 6px; width: 100%;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  font-size: .95rem; text-align: left; cursor: pointer;
}
.sell-result .r-name { font-weight: 600; }
.sell-result .r-meta { font-size: .78rem; color: var(--muted); }
.sell-result .r-price { color: var(--green); font-weight: 700; flex-shrink: 0; }
.sell-result:disabled { opacity: .5; }

.cart-line {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; margin-bottom: 8px;
}
.cart-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cart-name { font-weight: 600; font-size: .95rem; }
.cart-remove {
  border: none; background: none; color: var(--red); font-size: 1.3rem;
  line-height: 1; cursor: pointer; padding: 2px 6px; flex-shrink: 0;
}
.cart-controls { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }
.cart-controls .field { flex: 1; margin-bottom: 0; }
.cart-controls input { padding: 9px 10px; font-size: .95rem; }
.cart-linetotal { font-weight: 700; font-size: .95rem; flex-shrink: 0; padding-bottom: 10px; min-width: 86px; text-align: right; }

.pay-row { display: flex; gap: 8px; margin: 14px 0 12px; }
.pay-btn {
  flex: 1; padding: 12px 4px; font-size: .9rem; font-weight: 700;
  border: 2px solid var(--line); border-radius: 10px; background: #fff;
  color: var(--muted); cursor: pointer;
}
.pay-btn.selected { border-color: var(--navy); color: var(--navy); background: #eef3f8; }

.charge-btn {
  width: 100%; padding: 16px; font-size: 1.1rem; font-weight: 700;
  background: var(--green); color: #fff; border: none; border-radius: 10px; cursor: pointer;
}
.charge-btn:disabled { opacity: .5; }

.credit-box { background: #fff8ec; border: 1px solid #f0d9a8; border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.credit-box .field { margin-bottom: 8px; }
.linklike { background: none; border: none; color: var(--navy); font-weight: 600; text-decoration: underline; cursor: pointer; font-size: .85rem; padding: 4px 0; }

/* ---- receipt ---- */
.receipt {
  font-family: "Courier New", ui-monospace, monospace;
  font-size: .82rem; color: #000; background: #fff;
  padding: 10px 6px; max-width: 300px; margin: 0 auto;
}
.receipt .r-center { text-align: center; }
.receipt .r-shop { font-size: 1rem; font-weight: 700; }
.receipt hr { border: none; border-top: 1px dashed #000; margin: 8px 0; }
.receipt table { width: 100%; border-collapse: collapse; }
.receipt td { padding: 2px 0; vertical-align: top; }
.receipt td.amt { text-align: right; white-space: nowrap; }
.receipt .r-total td { font-weight: 700; font-size: .95rem; padding-top: 6px; }

@media print {
  body * { visibility: hidden; }
  #receiptPaper, #receiptPaper * { visibility: visible; }
  #receiptPaper { position: absolute; left: 0; top: 0; width: 72mm; max-width: none; padding: 0; }
}

/* ---- day report ---- */
.report-cards { display: flex; gap: 8px; margin-bottom: 14px; }
.report-card {
  flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 10px; text-align: center;
}
.report-card .rc-label { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.report-card .rc-value { font-size: 1.02rem; font-weight: 700; margin-top: 3px; }

/* ---- more tab ---- */
.menu-item {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px; margin-bottom: 9px; width: 100%;
  text-align: left; font-size: 1rem; font-weight: 600; color: var(--text); cursor: pointer;
}
.menu-item small { display: block; font-weight: 400; color: var(--muted); font-size: .8rem; margin-top: 2px; }
.section-title { font-size: .85rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 18px 0 8px; }
