/* مصدر القيم: DESIGN.md. السِّترين لا يظهر إلا في ختم التأكيد. */
@font-face { font-family: 'Alan Sans'; src: url('/shared/fonts/alan-sans-arabic.woff2') format('woff2'); font-weight: 300 900; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+060C, U+061B, U+061F; }
@font-face { font-family: 'Alan Sans'; src: url('/shared/fonts/alan-sans-latin.woff2') format('woff2'); font-weight: 300 900; font-display: swap; unicode-range: U+0020-007E, U+00A0-00FF, U+2010-2027, U+2030-203A, U+20AC; }

:root {
  --oxblood: #3a0a17; --oxblood-deep: #1e0509; --pearl: #f6efe9; --palm: #3fbf93; --muted: #b9a4a0; --citrine: #e6e23a; --danger: #ff9a8a;
  --line: color-mix(in srgb, var(--pearl) 18%, transparent);
  --raise: color-mix(in srgb, var(--pearl) 6%, var(--oxblood));
  --font: 'Alan Sans', ui-sans-serif, system-ui, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --r: 14px;
  color-scheme: dark;
}
@media (color-gamut: p3) { :root { --citrine: oklch(0.9 0.19 110); } }
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--oxblood); }
body { margin: 0; min-height: 100dvh; font: 400 1.0625rem/1.65 var(--font); color: var(--pearl); background: var(--oxblood); -webkit-text-size-adjust: 100%; }
h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.25; text-wrap: balance; }
h1 { font-size: clamp(1.6rem, 5vw, 2.1rem); } h2 { font-size: 1.25rem; } p { margin: 0; text-wrap: pretty; }
a { color: inherit; text-underline-offset: 0.3em; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--pearl); outline-offset: 3px; border-radius: 6px; }
.skip { position: absolute; inset-inline-start: 1rem; top: -4rem; background: var(--pearl); color: var(--oxblood); padding: 0.6rem 1rem; border-radius: 8px; z-index: 10; }
.skip:focus { top: 1rem; }

.shell { width: min(100% - 2.5rem, 30rem); margin-inline: auto; padding-block: 1.25rem 4rem; display: grid; gap: 1.75rem; }
.top { display: flex; align-items: center; justify-content: space-between; min-height: 2.75rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 700; text-decoration: none; }
.mark { display: inline-block; width: 2.6rem; aspect-ratio: 616 / 299; background: currentColor; -webkit-mask: url(/shared/symbol-small.svg) center / contain no-repeat; mask: url(/shared/symbol-small.svg) center / contain no-repeat; }

.btn { font: inherit; font-weight: 600; min-height: 3rem; padding: 0.7rem 1.4rem; border-radius: 10px; border: 1px solid var(--pearl); background: var(--pearl); color: var(--oxblood); cursor: pointer; transition: transform 0.18s var(--ease), background 0.18s var(--ease); display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; text-decoration: none; }
.btn:hover { transform: translateY(-1px); } .btn:active { transform: translateY(1px) scale(0.99); }
.btn.ghost { background: none; color: var(--pearl); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--pearl); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }
.link { font: inherit; background: none; border: 0; color: var(--muted); cursor: pointer; min-height: 2.75rem; padding: 0 0.25rem; text-decoration: underline; text-underline-offset: 0.3em; }
.link:hover { color: var(--pearl); }

form { display: grid; gap: 1rem; }
label { display: grid; gap: 0.4rem; font-weight: 600; font-size: 0.95rem; }
label small { font-weight: 400; color: var(--muted); }
input { font: inherit; font-size: 1.0625rem; color: var(--pearl); background: var(--oxblood-deep); border: 1px solid var(--line); border-radius: 10px; min-height: 3rem; padding: 0.6rem 0.9rem; width: 100%; }
input:hover { border-color: color-mix(in srgb, var(--pearl) 40%, transparent); }
input[aria-invalid="true"] { border-color: var(--danger); }
.pin { letter-spacing: 0.6em; text-align: center; font-size: 1.5rem; direction: ltr; }
.err { color: var(--danger); font-size: 0.95rem; min-height: 1.4em; }
.note { color: var(--muted); font-size: 0.95rem; }
.panel { background: var(--raise); border: 1px solid var(--line); border-radius: var(--r); padding: 1.25rem; display: grid; gap: 0.9rem; }
.row { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; padding-block: 0.65rem; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.tag { font-size: 0.8rem; padding: 0.15rem 0.6rem; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); }
.tag.ok { color: var(--palm); border-color: color-mix(in srgb, var(--palm) 50%, transparent); }
.tag.bad { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, transparent); }

/* بطاقة المحفظة: رقم من 12 خانة وصلاحية واسم. التفويض بـPIN لا بـCVV فلا حقل له على البطاقة. */
.card { aspect-ratio: 1.586; border-radius: 18px; padding: 1.4rem; display: grid; grid-template-rows: auto 1fr auto; background: linear-gradient(150deg, var(--oxblood-deep), color-mix(in srgb, var(--oxblood) 70%, #000)); border: 1px solid var(--line); position: relative; overflow: hidden; }
.card::after { content: ''; position: absolute; inset-inline-end: -18%; top: -30%; width: 70%; aspect-ratio: 1; border-radius: 50%; border: 1px solid var(--line); box-shadow: 0 0 0 28px color-mix(in srgb, var(--pearl) 3%, transparent), 0 0 0 56px color-mix(in srgb, var(--pearl) 2%, transparent); pointer-events: none; }
.card .brandline { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; }
.card .digits { align-self: center; font-size: clamp(1.25rem, 6.4vw, 1.7rem); letter-spacing: 0.12em; font-weight: 600; }
.card .meta { display: flex; justify-content: space-between; align-items: end; gap: 1rem; }
.card .meta small { display: block; color: var(--muted); font-size: 0.72rem; }
.balance { display: grid; gap: 0.2rem; }
.balance strong { font-size: clamp(2.2rem, 9vw, 3rem); font-weight: 800; line-height: 1.1; }
.balance .unit { font-size: 1rem; font-weight: 500; color: var(--muted); margin-inline-start: 0.4rem; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.tabs { display: flex; gap: 0.5rem; }
.tabs button { font: inherit; background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 99px; min-height: 2.75rem; padding: 0 1.1rem; cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--oxblood); background: var(--pearl); border-color: var(--pearl); }
.amt.pos { color: var(--palm); }
.empty { color: var(--muted); padding-block: 1rem; text-align: center; }
.loading { color: var(--muted); padding-block: 3rem; text-align: center; }

/* ختم التأكيد: اللحظة الوحيدة التي يظهر فيها السِّترين. */
.stamp { display: grid; place-items: center; gap: 1rem; text-align: center; padding-block: 1.5rem; }
.stamp .seal { width: 6.5rem; height: 6.5rem; border-radius: 50%; background: var(--citrine); color: var(--oxblood-deep); display: grid; place-items: center; animation: seal 0.7s var(--ease) both; }
.stamp .seal svg { width: 3.4rem; height: 3.4rem; stroke: currentColor; stroke-width: 3.2; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw 0.5s 0.35s var(--ease) forwards; }
@keyframes seal { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .stamp .seal, .stamp .seal svg { animation: none; stroke-dashoffset: 0; } .btn { transition: none; } }
@media (max-width: 420px) { .actions { grid-template-columns: 1fr; } }

.shell.wide { width: min(100% - 2.5rem, 56rem); }
.item { display: grid; gap: 0.75rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .btns { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.item input { max-width: 18rem; }
.btn.sm { min-height: 2.75rem; padding: 0.4rem 1rem; }
.btn.danger { background: none; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.stat { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.75rem; }
.stat div { background: var(--raise); border: 1px solid var(--line); border-radius: var(--r); padding: 0.9rem 1rem; display: grid; gap: 0.15rem; }
.stat strong { font-size: 1.4rem; }
.stack { display: grid; gap: 1.25rem; }

.secret { display: block; overflow-wrap: anywhere; background: var(--oxblood-deep); border: 1px solid var(--line); border-radius: 10px; padding: 0.8rem 1rem; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 0.9rem; }
.btns { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.fs { border: 1px solid var(--line); border-radius: 10px; padding: 0.8rem 1rem; display: grid; gap: 0.3rem; margin: 0; }
.fs legend { padding-inline: 0.4rem; font-weight: 600; font-size: 0.95rem; }
.chk { display: flex; flex-direction: row; align-items: center; gap: 0.6rem; font-weight: 400; min-height: 2.75rem; direction: ltr; justify-content: flex-end; }
.chk input { width: 1.25rem; min-height: 0; height: 1.25rem; accent-color: var(--pearl); }
select { font: inherit; font-size: 1.0625rem; color: var(--pearl); background: var(--oxblood-deep); border: 1px solid var(--line); border-radius: 10px; min-height: 3rem; padding: 0.6rem 0.9rem; width: 100%; }
