:root {
  --plum: #6b2a6e; --plum-dark: #4d1c50; --gold: #b8892f; --bg: #f8f2f6; --card: #fff;
  --text: #2b1d2c; --muted: #7d6b7e; --line: #eadfe8; --ok: #1c7c4a; --warn: #b45309; --bad: #b3261e;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 "Segoe UI", Tahoma, "Noto Sans Arabic", sans-serif; }
#app { max-width: 720px; margin: 0 auto; padding: 0 12px 60px; }
header { background: var(--plum); color: #fff; margin: 0 -12px 14px; padding: 14px 16px; display: flex; align-items: center; gap: 10px; }
header h1 { font-size: 18px; margin: 0; flex: 1; }
header a, header button { color: #fff; background: rgba(255,255,255,.15); border: 0; border-radius: 8px; padding: 6px 12px; font: inherit; font-size: 14px; text-decoration: none; cursor: pointer; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.card h2 { font-size: 16px; margin: 0 0 10px; color: var(--plum-dark); }
.muted { color: var(--muted); font-size: 14px; }
.center { text-align: center; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 20px; color: var(--plum-dark); direction: ltr; }
.stat.gold b { color: var(--gold); }
.stat span { font-size: 12px; color: var(--muted); }
button, .btn { font: inherit; border: 0; border-radius: 10px; padding: 10px 16px; background: var(--plum); color: #fff; cursor: pointer; text-decoration: none; display: inline-block; }
button:disabled { opacity: .5; cursor: default; }
button.light, .btn.light { background: #f1e6f0; color: var(--plum-dark); }
button.danger { background: #fbe9e7; color: var(--bad); }
button.small, .btn.small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
button.big { width: 100%; padding: 14px; font-size: 17px; }
input[type=text], input[type=search], input[type=password], input[type=tel], input[type=number] {
  font: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--text);
}
input:focus { outline: 2px solid var(--plum); outline-offset: -1px; }
label { display: block; font-size: 14px; color: var(--muted); margin: 10px 0 4px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 0; }
.list a.item { display: flex; align-items: center; gap: 10px; padding: 12px 4px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.list a.item:last-child { border-bottom: 0; }
.item .name { flex: 1; font-weight: 600; }
.item .sub { font-size: 13px; color: var(--muted); font-weight: 400; }
.item .amt { text-align: left; direction: ltr; font-weight: 700; color: var(--plum-dark); }
.item .amt small { display: block; font-weight: 400; color: var(--gold); }
.drop { display: block; border: 2px dashed var(--plum); border-radius: 14px; padding: 22px 12px; text-align: center; color: var(--plum-dark); background: #fbf6fa; cursor: pointer; font-weight: 600; }
.drop input { display: none; }
.rec { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.rec:last-child { border-bottom: 0; }
.rec img { width: 56px; height: 84px; object-fit: cover; object-position: top; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; flex: none; background: #eee; }
.rec .body { flex: 1; min-width: 0; }
.rec .meta { font-size: 12px; color: var(--muted); direction: ltr; text-align: right; word-break: break-all; }
.rec input.amount { width: 110px; direction: ltr; text-align: center; font-weight: 700; padding: 6px; }
.rec input.amount.empty { border-color: var(--bad); background: #fff5f4; }
.rec.off { opacity: .6; }
.tag { display: inline-block; font-size: 12px; border-radius: 6px; padding: 1px 7px; margin: 2px 0 2px 4px; }
.tag.ok { background: #e3f4ea; color: var(--ok); }
.tag.warn { background: #fdf0dc; color: var(--warn); }
.tag.bad { background: #fbe9e7; color: var(--bad); }
.total { display: flex; justify-content: space-between; padding: 6px 0; }
.total b { direction: ltr; }
.total.main { font-size: 19px; color: var(--plum-dark); border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }
.linkbox { direction: ltr; font-size: 12px; background: #fbf6fa; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#viewer { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; z-index: 10; cursor: zoom-out; }
#viewer[hidden], #toast[hidden] { display: none; }
#viewer img { max-width: 96vw; max-height: 96vh; border-radius: 8px; }
#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #2b1d2c; color: #fff; padding: 10px 18px; border-radius: 12px; z-index: 20; max-width: 92vw; text-align: center; }
.login { max-width: 360px; margin: 12vh auto 0; text-align: center; }
.login h1 { color: var(--plum); font-size: 22px; }
details summary { cursor: pointer; color: var(--plum-dark); }
