/* =======================================================================
   Store Revenue Tracker — minimalist black / white / gold, Arial, mobile.
   ======================================================================= */
:root {
  --bg: #0a0a0b;
  --card: #141416;
  --card-2: #1b1b1e;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --gold: #d4af37;
  --gold-2: #ecd085;
  --gold-dim: rgba(212, 175, 55, 0.14);
  --danger: #e5533c;
  --ok: #46b26a;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}

/* ---------- Header ---------- */
.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: rgba(10, 10, 11, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  margin-right: auto;
  min-width: 0;
}
.brand b {
  font-size: 16px;
  letter-spacing: 0.3px;
}
.brand .brand-gold { color: var(--gold); }
.brand small {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.iconbtn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 10px;
  height: 36px;
  min-width: 36px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
}
.iconbtn:active { transform: scale(0.97); }
.lang-toggle { letter-spacing: 1px; }
.lang-toggle .on { color: var(--gold); }
.lang-toggle .off { color: var(--muted); }

/* dropdown menu */
.menu-wrap { position: relative; }
.menu {
  position: absolute;
  right: 0;
  top: 42px;
  background: var(--card-2);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  min-width: 190px;
}
.menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  padding: 12px 14px;
  font-size: 14px;
  cursor: pointer;
}
.menu button + button { border-top: 1px solid var(--line); }
.menu button:active { background: var(--card); }
.hidden { display: none !important; }

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 6px;
  padding: 10px 12px 0;
}
.tabs button {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: bold;
  padding: 10px 4px 12px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tabs button.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* ---------- Content ---------- */
main {
  flex: 1;
  padding: 16px;
  padding-bottom: 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.card.tight { padding: 12px; }

.section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
  margin: 2px 0 10px;
}

/* stat tiles */
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}
.stat .value {
  font-size: 30px;
  font-weight: bold;
  margin-top: 6px;
}
.stat.gold .value { color: var(--gold); }

/* big hero total */
.hero {
  background: linear-gradient(160deg, #1c1913 0%, var(--card) 60%);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.hero .label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--muted);
}
.hero .value {
  font-size: 46px;
  font-weight: bold;
  color: var(--gold);
  margin: 6px 0 2px;
  line-height: 1;
}
.hero .sub { color: var(--muted); font-size: 13px; }

/* ---------- Amount entry ---------- */
.entry .amount-input {
  width: 100%;
  text-align: center;
  font-size: 44px;
  font-weight: bold;
  letter-spacing: 1px;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 10px;
  outline: none;
}
.entry .amount-input:focus { border-color: var(--gold); }
.entry .hint {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin: 8px 0 12px;
}
.btn-pay {
  width: 100%;
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #1a1400;
  font-size: 20px;
  font-weight: bold;
  padding: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-pay:active { transform: scale(0.99); filter: brightness(1.05); }
.btn-pay:disabled { opacity: 0.5; cursor: default; }

/* ---------- Buttons ---------- */
.btn {
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #1a1400;
  font-weight: bold;
  font-size: 14px;
  padding: 12px 14px;
  cursor: pointer;
}
.btn:active { transform: scale(0.99); }
.btn.block { width: 100%; }
.btn-ghost {
  background: none;
  border: 1px solid var(--line-strong);
  color: var(--text);
}
.btn-danger { background: none; border: 1px solid var(--danger); color: var(--danger); }
.btn-sm { padding: 8px 10px; font-size: 13px; border-radius: 8px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Forms ---------- */
.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}
.input, select.input {
  width: 100%;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-size: 16px;
  padding: 12px;
  outline: none;
  font-family: inherit;
}
.input:focus { border-color: var(--gold); }
select.input { appearance: none; }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 4px;
  border-top: 1px solid var(--line);
}
.row:first-child { border-top: none; }
.row .rank {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 50%;
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
}
.row .rank.top { background: var(--gold-dim); color: var(--gold); border-color: rgba(212,175,55,.4); }
.row .main { flex: 1; min-width: 0; }
.row .main .name { font-weight: bold; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .main .meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.row .amount { font-weight: bold; font-size: 16px; }
.row .amount.gold { color: var(--gold); }
.row.clickable { cursor: pointer; }
.row.clickable:active { background: var(--card-2); }
.row .chev { color: var(--muted); font-size: 18px; }

.pill {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
}
.pill.gold { color: var(--gold); border-color: rgba(212,175,55,.4); background: var(--gold-dim); }
.pill.off { color: var(--danger); border-color: rgba(229,83,60,.4); }
.pill.ok { color: var(--ok); border-color: rgba(70,178,106,.4); }

.empty { color: var(--muted); text-align: center; padding: 26px 10px; font-size: 14px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* ---------- Login ---------- */
.login-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  gap: 18px;
}
.login-logo { text-align: center; margin-bottom: 6px; }
.login-logo .mark {
  font-size: 30px;
  font-weight: bold;
  letter-spacing: 1px;
}
.login-logo .mark span { color: var(--gold); }
.login-logo .tag { color: var(--muted); font-size: 13px; margin-top: 6px; }

/* ---------- Toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: var(--card-2);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
  max-width: 88%;
  text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.ok { border-color: rgba(70,178,106,.5); }
#toast.err { border-color: rgba(229,83,60,.5); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 90;
}
.modal {
  width: 100%;
  max-width: 480px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 18px 18px 0 0;
  padding: 18px;
  box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 14px; font-size: 17px; }
@media (min-width: 520px) {
  .modal-backdrop { align-items: center; }
  .modal { border-radius: 18px; }
}

/* small loading shimmer */
.loading { color: var(--muted); text-align: center; padding: 30px; font-size: 14px; }
.dot-live {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ok);
  margin-right: 6px;
  vertical-align: middle;
  box-shadow: 0 0 0 0 rgba(70,178,106,.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(70,178,106,.5); }
  70% { box-shadow: 0 0 0 7px rgba(70,178,106,0); }
  100% { box-shadow: 0 0 0 0 rgba(70,178,106,0); }
}

/* =======================================================================
   v2 — NexoMilo branding, numpad, check-in, tombstones, week navigator
   ======================================================================= */

/* brand: logo mark + text */
.brand { flex-direction: row; align-items: center; gap: 10px; }
.brand-mark { width: 32px; height: 32px; flex: 0 0 32px; }
.brand-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
.login-mark { width: 168px; height: auto; display: block; margin: 0 auto 4px; }

/* numeric keypad for revenue entry */
.amount-display {
  width: 100%;
  text-align: center;
  font-size: 46px;
  font-weight: bold;
  letter-spacing: 1px;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 10px;
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.amount-display.empty { color: #4b4b52; }
.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 12px 0;
}
.numpad button {
  font-size: 24px;
  font-weight: bold;
  padding: 16px 0;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}
.numpad button:active { background: #262629; transform: scale(0.97); }
.numpad .np-action { color: var(--gold); font-size: 20px; }

/* check-in */
.checkin-cta { text-align: center; }
.checkin-cta .big-emoji { font-size: 34px; }
.pos-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--gold-dim);
  border: 1px solid rgba(212,175,55,.4);
  color: var(--gold);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: bold;
  font-size: 14px;
}
.pos-badge .num {
  background: var(--gold);
  color: #1a1400;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px;
}

/* deleted (tombstone) rows — red, transparent history */
.row.deleted .name { color: var(--muted); text-decoration: line-through; }
.row.deleted .amount { color: var(--danger); text-decoration: line-through; opacity: .85; }
.tomb {
  font-size: 10px;
  font-weight: bold;
  letter-spacing: .6px;
  color: var(--danger);
  border: 1px solid rgba(229,83,60,.45);
  background: rgba(229,83,60,.10);
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

/* week navigator */
.weeknav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.weeknav .range { text-align: center; flex: 1; }
.weeknav .range b { font-size: 14px; }
.weeknav .range small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 2px; }

/* info banner (entry closed etc.) */
.banner {
  border: 1px solid var(--line-strong);
  background: var(--card-2);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.banner.warn { border-color: rgba(229,83,60,.45); color: #e8b6ac; }
.banner .big-emoji { font-size: 30px; display: block; margin-bottom: 6px; }

/* =======================================================================
   v3 — green revenues, iOS-style toggle, grouped accounts, closed state
   ======================================================================= */
:root { --green: #22c55e; --green-soft: rgba(34, 197, 94, 0.14); }

/* revenues in light green; deleted stay red (specificity matches the v1 rules) */
.row .amount.gold { color: var(--green); }
.stat.gold .value { color: var(--green); }
.hero .value { color: var(--green); }
.hero { background: linear-gradient(160deg, #12140f 0%, var(--card) 60%); }
.row.deleted .amount { color: var(--danger); }

/* iOS-style active / inactive toggle */
.switch { position: relative; display: inline-block; width: 46px; height: 28px; flex: 0 0 auto; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
.switch .track {
  position: absolute; inset: 0; border-radius: 999px;
  background: #3a3a40; transition: background .25s ease;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.switch .knob {
  position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; transition: transform .25s ease; box-shadow: 0 1px 3px rgba(0,0,0,.5);
  pointer-events: none;
}
.switch input:checked ~ .track { background: linear-gradient(180deg, var(--gold-2), var(--gold)); }
.switch input:checked ~ .knob { transform: translateX(18px); }
.switch input:disabled { cursor: default; }
.switch.locked { opacity: .5; }

/* accounts grouped by type, symmetric rows */
.acc-group-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--gold); margin: 16px 2px 4px; font-weight: bold;
}
.acc-group-title:first-child { margin-top: 4px; }
.acc-row { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-top: 1px solid var(--line); }
.acc-row + .acc-row { border-top: 1px solid var(--line); }
.acc-group .acc-row:first-of-type { border-top: none; }
.acc-row .a-main { flex: 1; min-width: 0; }
.acc-row .a-name { font-weight: bold; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-row.off .a-name { color: var(--muted); }
.acc-row .a-user { color: var(--muted); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-row .a-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.acc-iconbtn {
  border: 1px solid var(--line-strong); background: var(--card-2); color: var(--text);
  width: 34px; height: 34px; border-radius: 9px; font-size: 14px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.acc-iconbtn.danger { border-color: rgba(229,83,60,.4); color: var(--danger); }

/* dimmed / closed */
.list.closed, .card.closed { opacity: .45; filter: grayscale(.35); pointer-events: none; }
