:root {
  --bg: #ffffff;
  --surface: #f7f8fa;
  --card: #ffffff;
  --text: #14161a;
  --muted: #6b7280;
  --border: #e3e6ea;
  --input-bg: #f2f3f5;
  --accent: #2f6fed;
  --accent-hover: #245bd0;
  --danger: #d64545;
  --success: #1f9d55;
}

:root[data-theme="dark"] {
  --bg: #17181c;
  --surface: #1f2126;
  --card: #212329;
  --text: #f2f3f5;
  --muted: #9aa1ad;
  --border: #33363d;
  --input-bg: #2a2d34;
  --accent: #2f6fed;
  --accent-hover: #3f7bf0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: Vazirmatn, Tahoma, "Segoe UI", sans-serif;
  background-color: var(--bg);
  color: var(--text);
  direction: rtl;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  /* NOTE: deliberately no transition on these two properties. Chromium pins the
     transitioned value when the *custom property itself* changes (theme switch),
     which left the page background stuck on the light colour after toggling to
     dark. Theme switching is instant instead. */
}

.card {
  width: 100%;
  max-width: 420px;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-head h1 {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
}

.theme-toggle {
  background-color: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 36px;
  height: 32px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  color: var(--text);
}

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.9;
  margin: 0 0 18px;
}

/* Keep numbers rendering LTR inside RTL copy (see .row .v.num). */
.num { direction: ltr; unicode-bidi: isolate; display: inline-block; }

.field {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
  background-color: var(--input-bg);
  margin-bottom: 14px;
}

.field .label {
  display: flex;
  align-items: center;
  padding: 0 14px;
  background-color: var(--card);
  border-inline-end: 1px solid var(--border);
  font-size: 13px;
  white-space: nowrap;
  color: var(--text);
}

.field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  padding: 13px 14px;
  font-size: 15px;
  font-family: inherit;
  letter-spacing: 1px;
  direction: ltr;
  text-align: left;
}

.field input::placeholder { color: var(--muted); opacity: 0.55; }

.btn {
  width: 100%;
  border: 0;
  border-radius: 9px;
  padding: 13px;
  font-size: 15px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  background-color: var(--accent);
  color: #fff;
  transition: background-color 0.15s ease;
}
.btn:hover:not(:disabled) { background-color: var(--accent-hover); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-link {
  width: 100%;
  background: none;
  border: 0;
  color: var(--accent);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 12px 0 0;
}
.btn-link:disabled { color: var(--muted); cursor: not-allowed; }

.divider { height: 1px; background-color: var(--border); margin: 18px 0 0; }

.msg {
  font-size: 13px;
  line-height: 1.8;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  display: none;
}
.msg.show { display: block; }
.msg.error { background: rgba(214, 69, 69, 0.12); color: var(--danger); }
.msg.info { background: rgba(47, 111, 237, 0.12); color: var(--accent); }
.msg.success { background: rgba(31, 157, 85, 0.12); color: var(--success); }

.hidden { display: none !important; }

/* ---------- panel ---------- */
.panel { max-width: 520px; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.panel-head .who { font-size: 15px; font-weight: 700; }
.panel-head .sub { color: var(--muted); font-size: 12px; margin-top: 3px; }

.balance {
  background: linear-gradient(135deg, #2f6fed, #6f4fe8);
  color: #fff;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
}
.balance .label { font-size: 12px; opacity: 0.85; }
.balance .value { font-size: 22px; font-weight: 700; margin-top: 6px; }

.rows { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: 0; }
.row .k { color: var(--muted); }
.row .v { font-weight: 600; }
/* Numeric values (national id, masked mobile) must stay LTR: inside an RTL row the
   bidi algorithm otherwise reorders "0912****063" into "063****0912". */
.row .v.num { direction: ltr; unicode-bidi: isolate; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge.approved { background: rgba(31, 157, 85, 0.15); color: var(--success); }
.badge.pending { background: rgba(230, 160, 30, 0.15); color: #c98a10; }
.badge.none, .badge.rejected { background: rgba(214, 69, 69, 0.13); color: var(--danger); }
