/* Riyal Slip — a remittance-slip look: sage banknote paper, deep ledger green, riyal gold. */
:root {
  --paper: #e9efea;
  --slip: #fbfcfa;
  --ink: #12332b;
  --ink-soft: #4d6860;
  --green: #1a6b4f;
  --green-wash: #dcebe3;
  --gold: #a8792a;
  --gold-wash: #f4ead6;
  --line: #c5d2ca;
  --danger: #a33a2e;
  --danger-wash: #f6e1dd;
  --focus: #1a6b4f;
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --body: "Figtree", system-ui, sans-serif;
  --urdu: "Noto Nastaliq Urdu", serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1d19; --slip: #16271f; --ink: #e3ede8; --ink-soft: #9db3aa;
    --green: #5cc49a; --green-wash: #1c3a2e; --gold: #d9ab5b; --gold-wash: #3a2f1a;
    --line: #2c4338; --danger: #f08a7c; --danger-wash: #3d211d; --focus: #5cc49a;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1rem/1.55 var(--body);
}
a { color: var(--green); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- customer page ---------- */
.page { max-width: 560px; margin: 0 auto; padding: 32px 16px 56px; }

.masthead { margin-bottom: 22px; }
.masthead h1 {
  font: 700 clamp(2rem, 7vw, 2.75rem)/1.02 var(--display);
  letter-spacing: -.02em; margin: 0;
}
.masthead .route { display: inline-flex; align-items: center; gap: .35em; }
.masthead .route svg { width: .8em; height: .8em; color: var(--gold); }
.masthead .ur { font: 400 1.05rem/2.1 var(--urdu); color: var(--ink-soft); margin: 6px 0 0; direction: rtl; text-align: left; }
.masthead p.lead { margin: 6px 0 0; color: var(--ink-soft); max-width: 46ch; }

/* The slip: guilloche band on top, perforation between stub and details */
.slip {
  background: var(--slip); border: 1px solid var(--line); border-radius: 18px;
  overflow: hidden; box-shadow: 0 1px 0 var(--line), 0 18px 40px -28px rgba(18, 51, 43, .45);
}
.guilloche {
  height: 14px;
  background:
    repeating-radial-gradient(circle at 0 100%, transparent 0 5px, var(--green) 5px 6px, transparent 6px 10px),
    repeating-radial-gradient(circle at 100% 100%, transparent 0 5px, var(--gold) 5px 6px, transparent 6px 10px),
    var(--green-wash);
  opacity: .85;
}
.stub { padding: 22px 22px 26px; }
.perf {
  position: relative; height: 0; border-top: 2px dashed var(--line); margin: 0 18px;
}
.perf::before, .perf::after {
  content: ""; position: absolute; top: -11px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--paper); border: 1px solid var(--line);
}
.perf::before { left: -30px; } .perf::after { right: -30px; }
.details { padding: 24px 22px 24px; }

.amount-label { display: block; font-weight: 600; margin-bottom: 8px; }
.amount-field {
  display: flex; align-items: baseline; gap: 10px;
  border-bottom: 3px solid var(--ink); padding-bottom: 4px;
}
.amount-field:focus-within { border-color: var(--green); }
.amount-field input {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink);
  font: 700 clamp(2.4rem, 11vw, 3.4rem)/1.1 var(--display); letter-spacing: -.02em;
  padding: 0; font-variant-numeric: tabular-nums;
}
.amount-field input:focus { outline: none; }
.amount-field .cur { font: 600 1.25rem var(--display); color: var(--gold); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.quick button {
  font: 500 .9rem var(--body); padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer;
}
.quick button:hover { border-color: var(--green); color: var(--green); }

fieldset { border: 0; padding: 0; margin: 0 0 20px; }
legend { font-weight: 600; margin-bottom: 10px; padding: 0; }
.choice { display: grid; gap: 10px; }
.choice label {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: start;
  padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer;
}
.choice label:has(input:checked) { border-color: var(--green); background: var(--green-wash); }
.choice input { margin: 4px 0 0; accent-color: var(--green); grid-row: span 2; }
.choice strong { font-weight: 600; }
.choice small { color: var(--ink-soft); grid-column: 2; }

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: 6px; }
.field .hint { font-weight: 400; color: var(--ink-soft); }
.field input, .field select, .field textarea {
  width: 100%; font: 400 1rem var(--body); color: var(--ink);
  padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--slip);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--green); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 460px) { .row2 { grid-template-columns: 1fr; } }
.bank-block[hidden] { display: none; }
.subhead { font: 600 1.05rem var(--display); margin: 22px 0 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 1rem var(--body); padding: 13px 20px; border-radius: 12px; cursor: pointer;
  border: 1.5px solid var(--ink); background: var(--ink); color: var(--slip); text-decoration: none;
}
.btn:hover { background: var(--green); border-color: var(--green); }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { border-color: var(--green); color: var(--green); background: transparent; }
.btn.small { padding: 7px 12px; font-size: .88rem; border-radius: 9px; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.gold:hover { filter: brightness(.95); background: var(--gold); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }

.note { color: var(--ink-soft); font-size: .9rem; margin: 14px 0 0; }
.error { background: var(--danger-wash); color: var(--danger); padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; }
.hp { position: absolute; left: -9999px; }

.receipt { text-align: left; }
.receipt .ref {
  font: 700 clamp(1.8rem, 8vw, 2.4rem)/1.1 var(--display); letter-spacing: .01em; margin: 6px 0 4px;
  color: var(--green); font-variant-numeric: tabular-nums;
}
.receipt dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 18px 0 0; }
.receipt dt { color: var(--ink-soft); }
.receipt dd { margin: 0; font-weight: 600; }
.stamp {
  display: inline-block; transform: rotate(-4deg); border: 2px solid var(--gold); color: var(--gold);
  padding: 4px 12px; border-radius: 8px; font: 700 1rem var(--display);
}

.foot { text-align: center; color: var(--ink-soft); font-size: .85rem; margin-top: 22px; }

/* ---------- admin ---------- */
.admin-shell { max-width: 1120px; margin: 0 auto; padding: 22px 16px 56px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.brand { font: 700 1.35rem var(--display); letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px var(--gold-wash); }
.tabs { display: flex; gap: 4px; background: var(--slip); border: 1px solid var(--line); padding: 4px; border-radius: 12px; }
.tabs a { padding: 7px 14px; border-radius: 9px; text-decoration: none; color: var(--ink-soft); font-weight: 600; font-size: .92rem; }
.tabs a[aria-current="page"] { background: var(--ink); color: var(--slip); }

.panel { background: var(--slip); border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin-bottom: 16px; }
.panel h2 { font: 700 1.2rem var(--display); margin: 0 0 4px; }
.panel .sub { color: var(--ink-soft); margin: 0 0 16px; font-size: .92rem; }

.ratebar { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 16px; }
.rate-tile { background: var(--slip); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.rate-tile .k { color: var(--ink-soft); font-size: .86rem; }
.rate-tile .v { font: 700 1.6rem/1.2 var(--display); font-variant-numeric: tabular-nums; }
.rate-tile .m { color: var(--ink-soft); font-size: .82rem; }
.rate-tile.mine { border-color: var(--green); background: var(--green-wash); }

.alert { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: .93rem; }
.alert.warn { background: var(--gold-wash); color: var(--ink); border: 1px solid var(--gold); }
.alert.ok { background: var(--green-wash); border: 1px solid var(--green); }

.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.filters a {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none;
  color: var(--ink); font-size: .88rem; font-weight: 500;
}
.filters a[aria-current="true"] { background: var(--ink); color: var(--slip); border-color: var(--ink); }
.filters .n { color: var(--ink-soft); margin-left: 4px; }
.filters a[aria-current="true"] .n { color: inherit; opacity: .7; }

.ledger { width: 100%; border-collapse: collapse; font-size: .93rem; }
.ledger th { text-align: left; font-weight: 600; color: var(--ink-soft); padding: 8px 10px; border-bottom: 2px solid var(--ink); white-space: nowrap; }
.ledger td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ledger .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger .ref { font-weight: 700; white-space: nowrap; }
.ledger .muted { color: var(--ink-soft); font-size: .85rem; }
.ledger .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ledger form { margin: 0; }
.big-pkr { font: 700 1.05rem var(--display); }

.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.chip.pending { background: var(--gold-wash); color: var(--gold); }
.chip.approved { background: var(--green-wash); color: var(--green); }
.chip.completed { background: var(--ink); color: var(--slip); }
.chip.rejected { background: var(--danger-wash); color: var(--danger); }

.empty { text-align: center; padding: 40px 10px; color: var(--ink-soft); }

/* Stack the ledger into cards on phones */
@media (max-width: 760px) {
  .ledger thead { display: none; }
  .ledger, .ledger tbody, .ledger tr, .ledger td { display: block; width: 100%; }
  .ledger tr { border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; margin-bottom: 10px; }
  .ledger td { border: 0; padding: 6px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .ledger td::before { content: attr(data-l); color: var(--ink-soft); font-weight: 500; text-align: left; }
  .ledger .num { text-align: right; }
  .ledger .actions { justify-content: flex-end; }
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }
.mode { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.mode label { display: flex; gap: 8px; align-items: center; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; }
.mode label:has(input:checked) { border-color: var(--green); background: var(--green-wash); }
.mode input { accent-color: var(--green); }
.preview { font-size: .9rem; color: var(--ink-soft); margin-top: -6px; margin-bottom: 14px; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: 100%; max-width: 380px; }
.login .stub h1 { font: 700 1.6rem var(--display); margin: 0 0 4px; }

/* helpers (replace inline styles so a strict Content-Security-Policy works) */
.note.tight { margin-top: 0; }
.login-intro { margin: 0 0 18px; }
.panel.narrow { max-width: 520px; }
.setup-error { max-width: 560px; margin: 60px auto; padding: 0 16px; }
.setup-error code { background: var(--gold-wash); padding: 1px 6px; border-radius: 5px; }

/* live estimate on the customer form */
.estimate {
  display: grid; gap: 2px; margin-top: 18px; padding: 14px 16px;
  border-radius: 12px; background: var(--green-wash); border: 1px solid var(--green);
}
.estimate[hidden] { display: none; }
.estimate.pay { background: var(--gold-wash); border-color: var(--gold); }
.est-label { font-weight: 600; font-size: .92rem; }
.est-value { font: 700 clamp(1.7rem, 8vw, 2.2rem)/1.15 var(--display); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.est-value small { font: 600 1rem var(--body); color: var(--ink-soft); }
.est-note { font-size: .8rem; color: var(--ink-soft); }
.estimate.loading .est-value { opacity: .45; }
.est-line { display: grid; gap: 0; padding-bottom: 8px; margin-bottom: 6px; border-bottom: 1px dashed var(--line); }
.est-line:last-of-type { border-bottom: 0; margin-bottom: 0; }

/* receipts */
.files { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 6px; }
.files li { padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--ink-soft); font-size: .85rem; }
.ledger .files { margin: 6px 0 0; }
.ledger .files li { padding: 4px 8px; font-size: .85rem; }
.badge-new { display: inline-block; background: var(--gold); color: #fff; font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; margin-left: 6px; }
.inline-form { display: grid; gap: 6px; justify-items: end; }
.inline-form input[type=file] { max-width: 210px; font-size: .8rem; }
.pct-in { width: 72px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--slip); color: var(--ink); font: inherit; font-size: .85rem; }
.approve-row { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }

/* summary */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--slip); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.stat h3 { font: 700 1.05rem var(--display); margin: 0 0 10px; }
.stat dl { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; }
.stat dt { color: var(--ink-soft); font-size: .9rem; }
.stat dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.stat .out { color: var(--danger); } .stat .in { color: var(--green); }
.tier-table { display: grid; gap: 8px; margin-bottom: 14px; }
.tier-row { display: grid; grid-template-columns: 1.3fr 1fr; gap: 10px; align-items: end; }
@media (max-width: 460px) { .tier-row { grid-template-columns: 1fr 1fr; } }

/* Urdu-first labels */
.ur-q { display: block; font: 600 1.25rem/2.1 var(--urdu); text-align: right; }
.ur-l { display: block; font: 500 1rem/2 var(--urdu); text-align: right; }
.ur-n { display: block; font: 400 .85rem/2 var(--urdu); text-align: right; }
.en-sub { display: block; font: 500 .82rem/1.4 var(--body); color: var(--ink-soft); }
.amount-label .en-sub { margin-top: -2px; }
legend .ur-l, legend .en-sub { display: block; }
.choice strong .ur-l { margin-bottom: 2px; }
.estimate { background: var(--slip); border-color: var(--line); }
.est-line { padding: 10px 12px; border-radius: 10px; border: 1.5px solid transparent; border-bottom: 1px dashed var(--line); }
.est-line .est-label { display: block; }
.est-line .est-value { display: block; text-align: right; }
.est-line.active { border: 1.5px solid var(--green); background: var(--green-wash); }
.est-line[data-for="to_ksa"].active { border-color: var(--gold); background: var(--gold-wash); }
.estimate { padding: 6px; gap: 4px; }
.estimate .est-note { padding: 4px 8px 6px; }
.est-line .est-value { margin-top: -4px; }

/* single-flow estimate: green = you receive, gold = you pay back */
.est-line.get { border: 1.5px solid var(--green); background: var(--green-wash); }
.est-line.pay { border: 1.5px solid var(--gold); background: var(--gold-wash); }
.ur-f { display: block; font: 500 .95rem/1.9 var(--urdu); text-align: right; }
.subhead .ur-l, .subhead .en-sub { display: block; }
.ur-btn { font-family: var(--urdu); font-weight: 600; }
.choice.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 460px) { .choice.two { grid-template-columns: 1fr; } }
.amounts { display: grid; gap: 10px; margin: 16px 0 6px; }
.amounts .est-line { display: grid; }

/* tracking + transfer receipt download */
.track-link { display: inline-block; margin-top: 10px; padding: 8px 14px; border: 1.5px solid var(--green); border-radius: 999px; text-decoration: none; font-weight: 600; font-size: .9rem; }
.track-link:hover { background: var(--green-wash); }
.transfer-box { border: 1.5px solid var(--green); background: var(--green-wash); border-radius: 12px; padding: 4px 14px 12px; margin-bottom: 18px; }
.transfer-box .subhead { margin: 10px 0 8px; }
.dl-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 0; }
.dl-actions { display: flex; gap: 6px; }
.dl-actions .btn { text-decoration: none; }

/* CNIC / ID documents */
.hint-line { display: block; font-size: .8rem; color: var(--ink-soft); margin-top: 4px; }
.id-ok, .id-missing { display: inline-block; font-size: .75rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; margin-top: 3px; }
.id-ok { background: var(--green-wash); color: var(--green); }
.id-missing { background: var(--danger-wash); color: var(--danger); }
.mini-label { font-size: .78rem; font-weight: 600; color: var(--ink-soft); }
.kind-in { width: auto; }
.nowrap { white-space: nowrap; }

tr.changed .js-send, tr.changed .js-pay { color: var(--gold); }
.disc-mini { font-size: .78rem; font-weight: 700; color: var(--gold); }
/* customer: approved banner + discount ribbon */
.approved-banner { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--green); color: #fff; margin: 14px 0 4px; }
.approved-banner .tick { flex: none; width: 30px; height: 30px; border-radius: 50%; background: #fff; color: var(--green); display: grid; place-items: center; font-weight: 800; }
.approved-banner strong { display: block; font: 600 1.05rem/1.9 var(--urdu); }
.approved-banner span { font-size: .85rem; opacity: .9; }
/* Special discount: a dark ledger-green seal with gold foil edge and one light sweep */
.discount-seal {
  position: relative; display: flex; align-items: center; gap: 14px; overflow: hidden;
  margin: 12px 0 4px; padding: 14px 16px; border-radius: 14px;
  background:
    repeating-radial-gradient(circle at 110% 50%, transparent 0 9px, rgba(217, 171, 91, .10) 9px 10px),
    linear-gradient(150deg, #0d3b2e 0%, #12332b 55%, #0a2a22 100%);
  color: #f6ecd6;
  border: 1px solid #d9ab5b;
  box-shadow: inset 0 0 0 3px #12332b, inset 0 0 0 4px rgba(217, 171, 91, .55), 0 14px 30px -18px rgba(10, 42, 34, .9);
}
.ds-star {
  flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #f3d491, #c8963a 60%, #9a6c1f);
  color: #12332b; box-shadow: 0 0 0 3px rgba(217, 171, 91, .25);
}
.ds-star svg { width: 24px; height: 24px; }
.ds-text { flex: 1; display: grid; }
.ds-ur { font: 600 1.15rem/2 var(--urdu); text-align: right; color: #f3d491; }
.ds-en { font: 700 .95rem var(--display); letter-spacing: .02em; color: #f6ecd6; }
.discount-seal::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255, 236, 190, .35), transparent);
  transform: skewX(-18deg);
}
@media (prefers-reduced-motion: no-preference) {
  .discount-seal { animation: seal-in .6s ease-out both; }
  .discount-seal::after { animation: sweep 1.6s .5s ease-out 1 both; }
  @keyframes seal-in { from { transform: translateY(6px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes sweep { to { left: 130%; } }
}


.rate-grid { display: grid; grid-template-columns: repeat(3, 76px); gap: 6px; }
.rate-grid label { display: grid; gap: 2px; font-size: .72rem; font-weight: 600; color: var(--ink-soft); text-align: left; }
.rate-grid .pct-in { width: 100%; }
