:root {
  color-scheme: only light;
  --bg: #F6F1E9;
  --card: #FFFDF8;
  --line: #DDD3C3;
  --green: #037A5A;
  --green-dark: #02573F;
  --gold: #E3BE6B;
  --gold-soft: #F6E3B4;
  --navy: #0B2540;
  --muted: #6B6458;
  --red: #B3261E;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Tahoma, "Noto Sans Arabic", sans-serif;
  color: var(--navy);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { min-height: 100vh; }
main { max-width: 520px; margin: 0 auto; padding: 0 16px 48px; }
h1 { font-size: 1.35rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 22px 0 10px; }
h3 { font-size: 1rem; margin: 0 0 8px; }
p { line-height: 1.5; }
a { color: var(--green); }
img { max-width: 100%; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; padding: 16px 0 6px; gap: 8px; }
.logo { height: 44px; width: auto; display: block; }
.top-actions { display: flex; gap: 8px; }
.titlebar { display: flex; align-items: center; gap: 12px; margin: 10px 0 14px; }
.back { font-size: 1.6rem; text-decoration: none; color: var(--navy); line-height: 1; padding: 4px 6px; }
.hello { margin: 4px 0 16px; color: var(--muted); }

/* buttons and inputs */
button, .btn {
  font: inherit; border: 1px solid transparent; border-radius: 12px; padding: 11px 16px; cursor: pointer;
  background: var(--green); color: #fff; font-weight: 600; text-decoration: none; display: inline-block; text-align: center;
}
button:hover, .btn:hover { background: var(--green-dark); }
button:disabled { opacity: .55; cursor: default; }
button.gold { background: var(--gold); color: var(--navy); border-color: #C9A04E; }
button.gold:hover { background: #D8AE55; }
button.ghost { background: transparent; color: var(--navy); border-color: var(--line); }
button.ghost:hover { background: var(--gold-soft); }
button.small { padding: 6px 12px; font-size: .9rem; border-radius: 10px; }
.chip { background: var(--card); color: var(--navy); border: 1px solid var(--line); padding: 6px 12px; font-size: .9rem; border-radius: 999px; font-weight: 600; }
.chip:hover { background: var(--gold-soft); }
.wide { width: 100%; }

label { display: block; font-size: .92rem; font-weight: 600; margin: 12px 0 6px; }
.hint { font-size: .82rem; color: var(--muted); font-weight: 400; margin-top: 4px; }
input, select, textarea {
  font: inherit; width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--navy);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green); outline-offset: 1px; border-color: var(--green); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; margin: 12px 0; }
.check input { width: 20px; height: 20px; accent-color: var(--green); }
.error { color: var(--red); font-size: .92rem; margin: 10px 0 0; min-height: 1.2em; }
form .actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }

/* cards and lists */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 10px 0; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  background: var(--gold-soft); border-radius: var(--radius); padding: 18px 12px; text-align: center; text-decoration: none;
  color: var(--navy); font-weight: 700; display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 96px; justify-content: center;
}
.tile:hover { background: #F1D79A; }
.tile.soon { background: #EEE8DD; color: var(--muted); font-weight: 600; }
.tile .icon { font-size: 1.6rem; }
.tile small { font-weight: 400; font-size: .8rem; }

.flags { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.flag-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; color: var(--navy); font-weight: 600; padding: 10px; border-radius: var(--radius); }
.flag-tile:hover { background: var(--gold-soft); }
.flag-tile img { width: 76px; height: 76px; }
.flag-tile.off { opacity: .45; }
.flag-sm { width: 34px; height: 34px; vertical-align: middle; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list a, .list .item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 4px; text-decoration: none; color: var(--navy); }
.list a:hover { background: var(--gold-soft); }
.sub { color: var(--muted); font-size: .85rem; }
.badge { font-size: .78rem; padding: 3px 9px; border-radius: 999px; background: #DDEFE8; color: var(--green-dark); white-space: nowrap; font-weight: 600; }
.badge.off { background: #EEE; color: #777; }

/* prices */
.app-card h3 { display: flex; justify-content: space-between; align-items: center; }
.price-row { padding: 10px 0; border-top: 1px dashed var(--line); }
.price-row:first-of-type { border-top: 0; }
.price-now { font-size: .9rem; color: var(--muted); margin: 2px 0 8px; }
.price-now b { color: var(--navy); }
.eq { display: grid; grid-template-columns: 1fr auto 1fr auto; align-items: center; gap: 8px; }
.eq span { font-size: .85rem; color: var(--muted); white-space: nowrap; }
.eq-actions { margin-top: 8px; }
.calc { background: #EAF4EF; border-color: #CBE3D7; }
.calc table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: .92rem; }
.calc th, .calc td { text-align: start; padding: 6px 4px; border-bottom: 1px solid #CBE3D7; }
.calc td.num { font-weight: 700; }
.history { font-size: .85rem; }
.history td, .history th { padding: 5px 4px; text-align: start; border-bottom: 1px solid var(--line); }
.history table { width: 100%; border-collapse: collapse; }

.log-item { font-size: .88rem; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.log-item .sub { display: block; }
.log-item code { display: block; font-size: .8rem; word-break: break-word; color: var(--muted); white-space: pre-line; text-align: left; margin-top: 4px; }

.empty { color: var(--muted); text-align: center; padding: 18px 0; }
.center { text-align: center; }
.mt { margin-top: 16px; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); color: #fff;
  padding: 10px 18px; border-radius: 999px; font-size: .92rem; opacity: 0; pointer-events: none; transition: opacity .2s;
  max-width: calc(100% - 32px);
}
#toast.show { opacity: .95; }
#toast.err { background: var(--red); }

.login-box { max-width: 380px; margin: 9vh auto 0; }
.login-box .logo { height: 70px; margin: 0 auto 26px; }

/* cashier */
.big { padding: 15px 18px; font-size: 1.05rem; }
.btn.gold-btn { background: var(--gold); color: var(--navy); border-color: #C9A04E; }
.btn.gold-btn:hover { background: #D8AE55; }
.alert { display: block; background: #FCE9D9; border: 1px solid #F0C29E; color: #7A3B0C; border-radius: 12px; padding: 12px 14px; text-decoration: none; font-weight: 600; }
.alert div { font-weight: 400; margin-top: 4px; }
.row-start { display: flex; align-items: center; gap: 10px; min-width: 0; }
.st { font-size: .78rem; padding: 4px 10px; border-radius: 999px; white-space: nowrap; font-weight: 700; background: #EEE; color: #555; }
.st-new { background: #FFF1C9; color: #7A5A00; }
.st-in_progress { background: #DCEBFF; color: #1D4F91; }
.st-done { background: #DDEFE8; color: var(--green-dark); }
.st-review, .st-returned { background: #FCE0DC; color: var(--red); }
.st-cancelled { background: #EEE; color: #777; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .95rem; }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv b { text-align: end; word-break: break-word; }
.kv.total b { font-size: 1.2rem; color: var(--green-dark); }
.choice { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 10px 0; text-decoration: none; color: var(--navy); }
.choice:hover { background: var(--gold-soft); }
.choice.off { opacity: .5; }
.pays { margin-top: 8px; font-size: 1.05rem; }
.pays b { color: var(--green-dark); font-size: 1.2rem; }
button.danger { color: var(--red); border-color: #E7B7B2; }
.tabs { display: flex; gap: 8px; margin: 4px 0 10px; }
.tab { flex: 1; text-align: center; padding: 9px 6px; border-radius: 999px; text-decoration: none; color: var(--navy); background: var(--card); border: 1px solid var(--line); font-weight: 600; font-size: .92rem; }
.tab.on { background: var(--green); color: #fff; border-color: var(--green); }
.sent-box { text-align: center; padding: 20px 0 10px; }
.big-icon { font-size: 3rem; line-height: 1; margin-bottom: 10px; }
.big-icon.ok { color: var(--green); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.timeline li:last-child { border-bottom: 0; }

/* processor and admin orders */
.tile.hot { background: #FCE0B8; outline: 2px solid #E9A85A; }
.warn-tag { font-size: .78rem; color: #8A4B00; font-weight: 700; margin-top: 2px; }
.copy-val { display: flex; align-items: center; gap: 8px; min-width: 0; }
.copy-val b { word-break: break-all; }
.send-amount { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #EAF4EF; border-radius: 12px; padding: 12px 14px; margin-top: 12px; }
.send-amount span { color: var(--muted); font-size: .9rem; }
.send-amount b { font-size: 1.35rem; color: var(--green-dark); }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gallery a { position: relative; display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); aspect-ratio: 1; background: #fff; }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery .tag { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(179, 38, 30, .85); color: #fff; font-size: .7rem; text-align: center; padding: 2px; }
button.danger-solid { background: var(--red); }
button.danger-solid:hover { background: #8E1E18; }
.offscreen { position: fixed; top: -1000px; left: -1000px; opacity: 0; }

/* balances */
.balance-card { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.balance-card b { display: block; font-size: 1.2rem; margin-top: 2px; }
.neg { color: var(--red); }
.pos { color: var(--green-dark); }
.timeline li.row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.end { text-align: end; white-space: nowrap; }
.kv.total b.neg, .balance-card b.neg { color: var(--red); }

/* search, WhatsApp, backup */
.search { display: flex; gap: 8px; margin: 4px 0 12px; }
.search input { flex: 1; }
.btn.whatsapp { background: #25D366; color: #08361C; }
.btn.whatsapp:hover { background: #1EBE5A; }
.btn.ghost-link { background: transparent; color: var(--navy); border: 1px solid var(--line); }
.btn.ghost-link:hover { background: var(--gold-soft); }

/* one Save button per page, and the pasted WhatsApp post */
.savebar { position: sticky; bottom: 0; padding: 12px 0 16px; background: linear-gradient(rgba(246, 241, 233, 0), var(--bg) 35%); }
.price-row.bad, .card.bad { outline: 2px solid var(--red); outline-offset: 4px; border-radius: 8px; }
.paste textarea { margin: 6px 0 10px; }
.paste-list { list-style: none; padding: 0; margin: 12px 0; }
.paste-list li { padding: 8px 0; border-top: 1px dashed var(--line); }
.paste-list .sub { margin-top: 2px; }
.paste-bad { color: var(--red); font-size: .9rem; margin: 10px 0; }
.paste-bad ul { padding-inline-start: 18px; margin: 6px 0; }

/* processor tabs in two rows; notifications card; WhatsApp buttons */
.tabs.two-rows { display: grid; grid-template-columns: 1fr 1fr; }
.notif p { margin: 0; }
.mt-s { margin-top: 8px; }

/* phone setup steps (required before work) */
.setup-steps { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 10px; }
.setup-steps > li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.setup-steps > li.now { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.setup-steps > li.later { opacity: .6; }
.setup-head { display: flex; align-items: center; gap: 10px; }
.setup-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--gold-soft); flex: none; }
.setup-steps > li.done .setup-num { background: var(--green); color: #fff; }
.setup-body { display: grid; gap: 10px; margin-top: 12px; }
.setup-body p { margin: 0; }
.guide h3 { margin: 0 0 6px; }
.guide ul { margin: 0; padding-inline-start: 18px; display: grid; gap: 4px; }
