/* New design (v2) — used only by the v2_*.php test pages */
:root {
  --brand: #4B2A86;
  --brand-dark: #2F1857;
  --brand-soft: #EDE5FA;
  --ground: #F6F3FB;
  --card: #ffffff;
  --line: #E4DCF2;
  --ink: #1E1733;
  --ink-2: #3A3150;
  --muted: #5C5470;
  --pos: #1E7A46;
  --neg: #B42318;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  overflow-x: hidden;
  max-width: 100%;
  background: var(--ground);
  color: var(--ink);
  font-family: 'IBM Plex Sans Arabic', system-ui, -apple-system, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--brand); }
a:hover { color: var(--brand-dark); }

.v2-wordmark { font-family: 'Pacifico', cursive; color: var(--brand); line-height: 1.25; direction: ltr; }
.v2-num { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.v2-cur img { width: 16px; height: auto; vertical-align: middle; }

.v2-icon-btn {
  width: 44px; height: 44px; border-radius: 22px;
  border: 1px solid var(--line); background: var(--card); color: var(--brand);
  display: inline-flex; align-items: center; justify-content: center;
  position: relative; text-decoration: none; cursor: pointer;
}
.v2-badge {
  position: absolute; top: -4px; inset-inline-end: -4px;
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--neg); color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.v2-pill {
  height: 44px; padding: 0 16px; border-radius: 22px;
  border: 1px solid var(--line); background: var(--card); color: var(--brand);
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-size: 15px; font-weight: 600; text-decoration: none;
}
.v2-switch-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none;
  padding: 10px 0; min-height: 44px;
}

/* ---------- login ---------- */
.v2-login { min-height: 100vh; display: flex; flex-direction: column; max-width: 480px; margin: 0 auto; }
.v2-login-top {
  background: var(--card); padding: 20px 24px 28px;
  border-radius: 0 0 32px 32px; box-shadow: 0 10px 30px rgba(75, 42, 134, 0.08);
  display: flex; flex-direction: column; gap: 18px;
}
.v2-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.v2-logo { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-top: 8px; }
.v2-logo .v2-wordmark { font-size: 40px; }
.v2-login-body { flex-grow: 1; padding: 32px 24px 24px; display: flex; flex-direction: column; gap: 22px; }
.v2-login-body h1 { margin: 0; font-size: 26px; font-weight: 700; }
.v2-sub { margin: 4px 0 0; font-size: 15px; color: var(--muted); }
.v2-form { display: flex; flex-direction: column; gap: 16px; margin: 0; }
.v2-field { display: flex; flex-direction: column; gap: 8px; }
.v2-field label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.v2-input {
  height: 54px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--card);
  display: flex; align-items: center; gap: 10px; padding-inline: 16px 6px;
}
.v2-input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(75, 42, 134, 0.10); }
.v2-input input {
  flex-grow: 1; min-width: 0; border: none; outline: none; background: transparent;
  font: inherit; font-size: 16px; color: var(--ink);
}
.v2-input input::placeholder { color: #7A738A; }
.v2-input .v2-eye { width: 44px; height: 44px; border: none; background: transparent; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.v2-alert { border-radius: 14px; padding: 12px 14px; background: #FDECEA; color: var(--neg); font-size: 14px; font-weight: 600; }
.v2-btn {
  height: 56px; border-radius: 16px; border: none; background: var(--brand); color: #fff;
  font: inherit; font-size: 17px; font-weight: 700; cursor: pointer;
  box-shadow: 0 12px 24px rgba(75, 42, 134, 0.28);
}
.v2-btn:active { background: var(--brand-dark); }
.v2-foot { margin-top: auto; text-align: center; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 4px; }

/* ---------- home ---------- */
.v2-home { max-width: 560px; margin: 0 auto; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.v2-head {
  background: var(--card); padding: 16px 20px 18px; border-radius: 0 0 28px 28px;
  display: flex; flex-direction: column; gap: 14px;
}
.v2-hello { display: flex; align-items: center; gap: 12px; min-width: 0; }
.v2-avatar { width: 46px; height: 46px; border-radius: 23px; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; flex-shrink: 0; }
.v2-hello small { display: block; font-size: 13px; color: var(--muted); }
.v2-hello strong { display: block; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v2-actions-top { display: flex; gap: 8px; flex-shrink: 0; }
.v2-select {
  width: 100%; height: 44px; border-radius: 14px; border: 1px solid var(--line); background: var(--ground);
  color: var(--ink-2); font: inherit; font-size: 14px; font-weight: 600; padding-inline: 14px;
}
.v2-main { padding: 20px; display: flex; flex-direction: column; gap: 20px; }
.v2-balance {
  background: var(--brand); color: #fff; border-radius: 24px; padding: 22px;
  display: flex; flex-direction: column; gap: 16px; position: relative; overflow: hidden;
  box-shadow: 0 16px 32px rgba(75, 42, 134, 0.30);
}
.v2-balance::before, .v2-balance::after {
  content: ""; position: absolute; border: 2px solid rgba(255, 255, 255, 0.14); border-radius: 50%; pointer-events: none;
}
.v2-balance::before { width: 240px; height: 240px; top: -110px; inset-inline-end: -80px; }
.v2-balance::after { width: 160px; height: 160px; top: -70px; inset-inline-end: -40px; }
.v2-balance .v2-row span { font-size: 14px; color: #E9DDFB; }
.v2-amount { display: flex; align-items: baseline; gap: 8px; }
.v2-amount .v2-num { font-size: 36px; font-weight: 700; }
.v2-amount .v2-cur img { filter: brightness(0) invert(1); width: 20px; }
.v2-neg-note { font-size: 13px; background: rgba(255, 255, 255, 0.16); border-radius: 10px; padding: 4px 10px; align-self: flex-start; }
.v2-balance-btns { display: flex; gap: 10px; position: relative; }
.v2-balance-btns a {
  flex: 1 1 0; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; text-decoration: none;
}
.v2-balance-btns .solid { background: #fff; color: var(--brand); }
.v2-balance-btns .ghost { background: rgba(255, 255, 255, 0.16); color: #fff; }

.v2-quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.v2-quick a { display: flex; flex-direction: column; align-items: center; gap: 8px; text-decoration: none; color: var(--ink-2); }
.v2-quick span.tile { width: 58px; height: 58px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); color: var(--brand); display: flex; align-items: center; justify-content: center; }
.v2-quick span.lbl { font-size: 13px; font-weight: 600; text-align: center; }

.v2-card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; }
.v2-count { padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.v2-count small { display: block; font-size: 13px; color: var(--muted); }
.v2-count strong { display: block; font-size: 15px; }
.v2-count-cells { display: flex; gap: 6px; }
.v2-count-cells div { width: 52px; border-radius: 12px; background: #F1EAFB; padding: 6px 0; display: flex; flex-direction: column; align-items: center; }
.v2-count-cells b { font-size: 18px; color: var(--brand); }
.v2-count-cells span { font-size: 11px; color: var(--muted); }

.v2-section-head { display: flex; align-items: center; justify-content: space-between; }
.v2-section-head h2 { margin: 0; font-size: 18px; }
.v2-list { display: flex; flex-direction: column; overflow: hidden; }
.v2-list a {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 64px;
  text-decoration: none; color: var(--ink); border-bottom: 1px solid #F0EBF7;
}
.v2-list a:last-child { border-bottom: none; }
.v2-list .ic { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.v2-list .lbl { flex-grow: 1; font-size: 15px; font-weight: 600; min-width: 0; }
.v2-list .val { display: flex; align-items: baseline; gap: 4px; flex-shrink: 0; }
.v2-list .val .v2-num { font-size: 16px; font-weight: 700; }
.v2-list .val small { font-size: 12px; color: var(--muted); }
.v2-list .chev { color: #9A93AB; flex-shrink: 0; }
[dir="ltr"] .v2-list .chev { transform: scaleX(-1); }
.tone-pos { color: var(--pos); }
.tone-neg { color: var(--neg); }
.tone-brand { color: var(--brand); }
.bg-pos { background: #E7F5EC; color: var(--pos); }
.bg-neg { background: #FDECEA; color: var(--neg); }
.bg-brand { background: #F1EAFB; color: var(--brand); }
.bg-warm { background: #FFF4E0; color: #8A5300; }

.v2-tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
}
.v2-tabs-inner { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.v2-tabs a { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px 0; min-height: 44px; text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 500; }
.v2-tabs a .pill { width: 52px; height: 30px; border-radius: 15px; display: flex; align-items: center; justify-content: center; }
.v2-tabs a.on { color: var(--brand); font-weight: 700; }
.v2-tabs a.on .pill { background: var(--brand-soft); }
