/* Account page and admin portal. Builds on site.css tokens. */

body.portal {
  min-height: 100vh;
  background:
    radial-gradient(50% 40% at 85% 0%, rgba(255, 194, 75, .18), transparent 70%),
    radial-gradient(40% 40% at 0% 100%, rgba(77, 210, 255, .07), transparent 70%),
    var(--bg);
}
.portal .nav { position: sticky; top: 14px; margin: 14px; inset-inline: auto; }
.portal-main { position: relative; z-index: 3; padding: 40px 6vw 80px; }
.portal-main .wrap { width: min(1200px, 100%); }
[hidden] { display: none !important; }

/* ------------------------------------------------------------------ forge mark */
.mark { width: 74px; height: 74px; position: relative; margin: 0 auto 18px; }
.mark i { position: absolute; inset: 0; transform: rotate(45deg); border-radius: 12px; border: 1px solid rgba(255, 90, 70, .7);
  background: linear-gradient(135deg, rgba(255, 194, 75, .35), rgba(20, 14, 4, .9)); box-shadow: 0 0 40px -6px rgba(255, 194, 75, .7), inset 0 0 20px rgba(255, 200, 90, .35); animation: mark-spin 9s linear infinite; }
.mark b { position: absolute; inset: 27px; transform: rotate(45deg); border-radius: 3px; background: #ffb070; box-shadow: 0 0 22px 4px rgba(255, 110, 50, .8); animation: mark-pulse 2.4s ease-in-out infinite; }
@keyframes mark-spin { to { transform: rotate(405deg); } }
@keyframes mark-pulse { 50% { box-shadow: 0 0 34px 8px rgba(255, 110, 50, .95); } }
@media (prefers-reduced-motion: reduce) { .mark i, .mark b { animation: none; } }

/* ------------------------------------------------------------------ forms */
.auth-card { max-width: 460px; margin: 30px auto 0; padding: 34px 32px; }
.auth-card h1 { font-size: 30px; text-align: center; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 24px 0 22px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid var(--line); }
.tabs button { border: 0; background: none; padding: 10px; border-radius: 9px; cursor: pointer; font-weight: 700; color: var(--dim); }
.tabs button[aria-selected="true"] { background: rgba(255, 194, 75, .16); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 194, 75, .45); }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 14px; font-weight: 600; color: var(--dim); }
.field small { color: var(--muted); font-size: 12px; }
.input, .select, textarea.input {
  width: 100%; padding: 12px 14px; border-radius: 11px; border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, .35); color: var(--text); font: inherit; font-size: 15px;
  transition: border-color .2s, box-shadow .2s;
}
.input:focus, .select:focus { outline: none; border-color: rgba(77, 210, 255, .6); box-shadow: 0 0 0 3px rgba(77, 210, 255, .15); }
.input[dir="ltr"] { text-align: left; }
textarea.input { min-height: 90px; resize: vertical; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%), linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-inline-end: 34px; }
html[dir="rtl"] .select { background-position: 13px 50%, 18px 50%; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--dim); cursor: pointer; }
.check input { accent-color: var(--gold); width: 16px; height: 16px; }
.form-error { min-height: 22px; margin: 4px 0 10px; color: #ff6b76; font-size: 14px; }
.form-ok { color: var(--green); }
.auth-card .btn { width: 100%; }
.auth-card .lead-sm { margin: -4px 0 22px; text-align: center; color: var(--dim); font-size: 14px; line-height: 1.85; }
.field-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.field-row a, .form-link a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.field-row a { font-size: 13px; }
.field-row a:hover, .form-link a:hover { color: var(--text); }
.form-link { margin: 16px 0 0; text-align: center; font-size: 14px; color: var(--muted); }
.form-link .btn { width: auto; }
.tag.ok { color: var(--green); border-color: rgba(60, 220, 130, .4); background: rgba(60, 220, 130, .10); }
.reset-link-box { display: grid; gap: 8px; margin-top: 12px; }
.reset-link-box code { display: block; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.05);
  border: 1px solid var(--line); font-size: 12px; direction: ltr; text-align: left; word-break: break-all; }
.btn.is-busy { pointer-events: none; opacity: .7; }

/* ------------------------------------------------------------------ dashboard */
.dash { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; margin-top: 10px; }
.dash .panel { padding: 28px; }
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.dash-head h1 { font-size: clamp(28px, 3vw, 40px); }
.dash-head p { margin: 4px 0 0; color: var(--dim); }
.rank { display: flex; align-items: center; gap: 18px; }
.rank .gem { width: 58px; height: 58px; transform: rotate(45deg); border-radius: 10px; flex: none; border: 1px solid rgba(255,255,255,.25); }
.rank .gem.free { background: linear-gradient(135deg, #9a9aa6, #3a3a44); }
.rank .gem.pro { background: linear-gradient(135deg, #ffdc92, #b8741a); box-shadow: 0 0 34px -4px rgba(255, 194, 75, .8); }
.rank .gem.extreme { background: linear-gradient(135deg, #ffc070, #ff5a1a 55%, #7a1a00); box-shadow: 0 0 40px -2px rgba(255, 138, 43, .85); }
.rank h2 { font-size: 34px; }
.rank p { margin: 0; color: var(--dim); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin-top: 22px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.feature-list { list-style: none; padding: 0; margin: 18px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 9px 16px; font-size: 14px; }
.feature-list li { display: flex; gap: 8px; color: var(--dim); }
.feature-list li::before { content: "✓"; color: var(--green); font-weight: 900; }
.feature-list li.off { opacity: .35; }
.feature-list li.off::before { content: "—"; color: var(--muted); }
.notice { margin-top: 18px; padding: 14px 16px; border-radius: 12px; border: 1px solid rgba(255, 176, 32, .35); background: rgba(255, 176, 32, .07); color: #ffd48a; font-size: 14px; }
.upgrade { margin-top: 22px; padding: 18px; border-radius: 14px; border: 1px dashed rgba(255, 194, 75, .45); background: rgba(255, 194, 75, .05); }
.upgrade p { margin: 0 0 8px; color: var(--dim); font-size: 14px; }
.copy-chip { display: inline-flex; gap: 8px; align-items: center; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.06); border: 1px solid var(--line-strong); cursor: copy; font-weight: 700; direction: ltr; }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
h3.section { font-size: 18px; margin-bottom: 14px; }

/* ------------------------------------------------------------------ admin */
.admin-grid { display: grid; grid-template-columns: 230px 1fr; gap: 20px; align-items: start; }
.side { position: sticky; top: 100px; padding: 14px; display: grid; gap: 4px; }
.side button { display: flex; align-items: center; gap: 10px; border: 0; background: none; text-align: start; padding: 11px 14px; border-radius: 10px; color: var(--dim); cursor: pointer; font-weight: 600; }
.side button:hover { background: rgba(255,255,255,.04); color: var(--text); }
.side button[aria-current="page"] { background: rgba(255, 194, 75, .14); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
html[dir="rtl"] .side button[aria-current="page"] { box-shadow: inset -3px 0 0 var(--gold); }
.side .who { padding: 10px 14px 14px; border-bottom: 1px solid var(--line); margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.side .who b { display: block; color: var(--text); font-size: 15px; }
.view { display: grid; gap: 18px; }
.view > .panel { padding: 24px; }
.view-title { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.view-title h1 { font-size: 30px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-card { padding: 20px; }
.stat-card span { color: var(--muted); font-size: 13px; }
.stat-card b { display: block; font-size: 38px; font-weight: 900; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-card.pro b { color: var(--gold); } .stat-card.extreme b { color: var(--ember); }
.bars { display: grid; gap: 10px; margin-top: 6px; }
.bar { display: grid; grid-template-columns: 90px 1fr 48px; gap: 12px; align-items: center; font-size: 14px; }
.bar div { height: 10px; border-radius: 99px; background: rgba(255,255,255,.06); overflow: hidden; }
.bar div i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--ember)); transition: width .8s var(--ease); }
.bar.free div i { background: #7d7d88; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .input { width: 300px; max-width: 100%; }
.box > .btn, .plan-editor > .btn, form.panel > .btn { width: 100%; }
.toolbar .select { width: auto; min-width: 150px; }
.table-wrap { overflow-x: auto; margin-top: 14px; border-radius: 12px; border: 1px solid var(--line); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
table.data th { text-align: start; font-weight: 600; color: var(--muted); padding: 11px 14px; background: rgba(255,255,255,.03); border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { cursor: pointer; transition: background .15s; }
table.data tbody tr:hover { background: rgba(255,255,255,.035); }
table.data.static tbody tr { cursor: default; }
.muted { color: var(--muted); }
.ltr { direction: ltr; unicode-bidi: embed; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; border: 1px solid var(--line-strong); white-space: nowrap; }
.tag.free { color: #c4c4cc; }
.tag.pro { color: #ffd27a; border-color: rgba(255, 194, 75, .5); background: rgba(255, 194, 75, .1); }
.tag.extreme { color: #ffb070; border-color: rgba(255, 138, 43, .5); background: rgba(255, 138, 43, .1); }
.tag.off { color: #ff6b76; border-color: rgba(255, 60, 70, .4); }
.tag.admin { color: var(--cyan); border-color: rgba(77, 210, 255, .4); }
.tag.beta { color: var(--amber); border-color: rgba(255, 176, 32, .4); }
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 12px; color: var(--muted); font-size: 14px; }

/* user drawer */
.drawer-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.55); backdrop-filter: blur(3px); }
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(520px, 100%); z-index: 41; overflow-y: auto; padding: 26px; border-radius: 0; border-inline-end: 0; background: rgba(12, 12, 16, .97); }
.drawer-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.drawer-head h2 { font-size: 26px; }
.close { border: 1px solid var(--line-strong); background: none; border-radius: 10px; width: 38px; height: 38px; cursor: pointer; font-size: 20px; color: var(--dim); }
.box { margin-top: 18px; padding: 18px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.02); }
.box h3 { font-size: 16px; margin-bottom: 12px; }
.plan-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.plan-pick label { position: relative; cursor: pointer; }
.plan-pick input { position: absolute; opacity: 0; }
.plan-pick span { display: block; text-align: center; padding: 12px 6px; border-radius: 11px; border: 1px solid var(--line-strong); font-weight: 700; transition: all .2s; }
.plan-pick input:checked + span { border-color: var(--gold); background: rgba(255, 194, 75, .14); color: #fff; }
.plan-pick input:focus-visible + span { outline: 2px solid var(--cyan); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chips button { border: 1px solid var(--line-strong); background: rgba(255,255,255,.03); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--dim); }
.chips button[aria-pressed="true"] { border-color: var(--cyan); color: #fff; background: rgba(77, 210, 255, .12); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.timeline li { padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.025); font-size: 13px; color: var(--dim); }
.timeline li b { color: var(--text); }
.btn-danger { background: rgba(255, 69, 58, .1); border-color: rgba(255, 69, 58, .45); color: #ff8a80; }
.btn-danger:hover { background: rgba(255, 69, 58, .2); }

/* plans editor */
.plan-editors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.plan-editor { padding: 20px; }
.plan-editor .feature-checks { display: grid; gap: 6px; margin: 10px 0 14px; }

/* releases */
.release-form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 14px; }
.release-form .full { grid-column: 1 / -1; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
code.sha { font-family: Consolas, monospace; font-size: 12px; direction: ltr; unicode-bidi: embed; color: var(--dim); }

.center-card { max-width: 520px; margin: 40px auto; padding: 34px; }
.center-card h1 { font-size: 28px; text-align: center; }
.center-card > p { text-align: center; color: var(--dim); }

@media (max-width: 1000px) {
  .dash, .admin-grid, .plan-editors { grid-template-columns: 1fr; }
  .side { position: static; grid-auto-flow: column; overflow-x: auto; }
  .side .who { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .feature-list, .two, .release-form { grid-template-columns: 1fr; }
  .auth-card { padding: 26px 20px; }
  .portal .nav-links { display: none; }
}
.dash form .btn { width: 100%; }
.nav-actions.end { margin-inline-start: auto; }
.center-card form .btn { width: 100%; }

/* ---- show / hide password: the eye sits at the right end, because password
   fields are left-to-right text on either page direction ---- */
.pw-wrap { position: relative; display: block; }
.pw-wrap .input { padding-right: 46px; }
.pw-toggle {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer;
}
.pw-toggle:hover { color: var(--text); background: rgba(255, 255, 255, .06); }
.pw-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(77, 210, 255, .35); color: var(--text); }
.pw-toggle[aria-pressed="true"] { color: #4dd2ff; }
.pw-toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---- the emailed-code step ---- */
.code-step { display: grid; }
.code-hint { margin: -4px 0 18px; text-align: center; color: var(--dim); font-size: 14px; line-height: 1.85; }
.code-input {
  text-align: center !important; font-size: 26px; font-weight: 800; letter-spacing: .45em; padding-left: .45em;
  font-family: Consolas, "Courier New", ui-monospace, monospace;
}
.resend-row { display: flex; justify-content: center; margin-top: 12px; }
.resend-row .btn { width: auto; }
.resend-row .btn:disabled { opacity: .6; cursor: default; }

/* ---- two-step in the account dashboard ---- */
h3.section.split { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
.tf-status { margin: 0 0 14px; color: var(--dim); font-size: 14px; line-height: 1.8; }
.tf-status.on { color: var(--green); }
#tf-box { display: grid; gap: 10px; }
#tf-box > .btn-sm { justify-self: center; }

/* ---------------------------------------------------------------- checkout (pay.html) */
.pay-wrap { max-width: 1060px; }
.pay-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 22px; align-items: start; margin-top: 12px; }
.pay-grid .panel { padding: 28px; }
.pay-summary h1 { font-size: 30px; margin: 0; }
.period-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 24px; }
.period-pick button {
  display: grid; gap: 2px; text-align: start; padding: 14px 16px; border-radius: 14px; cursor: pointer;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--line); color: var(--dim);
  transition: border-color .2s, background .2s;
}
.period-pick button b { color: var(--text); font-size: 16px; }
.period-pick button em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--green); }
.period-pick button:hover { border-color: var(--line-strong); }
.period-pick button[aria-checked="true"] { border-color: rgba(255, 194, 75, .75); background: rgba(255, 194, 75, .09); color: var(--text); }
.pay-total { font-size: 22px; font-weight: 800; color: var(--gold); }
.pay-methods { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 16px; direction: ltr; justify-content: flex-end; }
html[dir="ltr"] .pay-methods { justify-content: flex-start; }
.pay-methods span {
  padding: 4px 10px; border-radius: 8px; font-size: 12px; font-weight: 700; letter-spacing: .02em;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--line); color: var(--dim);
}
.pay-go { width: 100%; font-size: 17px; padding: 15px 20px; }
.pay-box .notice { margin: 0 0 14px; }
/* Moyasar draws its own light form: it sits on a light card instead of fighting the theme */
.mysr-form:not(:empty) { background: #fbfbfd; color: #111; border-radius: 16px; padding: 18px 16px 8px; margin-top: 4px; }
.pay-trust { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 8px; font-size: 13.5px; color: var(--dim); line-height: 1.7; }
.pay-legal { margin: 14px 0 0; font-size: 13px; color: var(--muted); }
.pay-legal a { color: var(--dim); text-decoration: underline; text-underline-offset: 3px; }
.result-icon { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; font-weight: 900; }
.result-icon.ok { background: rgba(48, 209, 88, .14); color: #30d158; box-shadow: inset 0 0 0 1px rgba(48, 209, 88, .45); }
.result-icon.ok::before { content: "✓"; }
.result-icon.bad { background: rgba(255, 69, 58, .12); color: #ff6b61; box-shadow: inset 0 0 0 1px rgba(255, 69, 58, .45); }
.result-icon.bad::before { content: "✕"; }
.result-icon.warn { background: rgba(255, 159, 10, .12); color: #ff9f0a; box-shadow: inset 0 0 0 1px rgba(255, 159, 10, .45); }
.result-icon.warn::before { content: "…"; }
#pay-result .row-actions { justify-content: center; }
#pay-result .row-actions .btn { width: auto; }
.pay-history { margin-top: 22px; }
.pay-history ul { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; font-size: 14px; }
.pay-history li { display: grid; grid-template-columns: 1.4fr auto auto auto; gap: 12px; align-items: center; padding: 10px 12px;
  border-radius: 10px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); }
.pay-history .muted { color: var(--muted); font-size: 13px; }
.pay-status { font-weight: 700; font-size: 13px; }
.pay-status.paid { color: #30d158; } .pay-status.failed, .pay-status.voided { color: #ff6b61; } .pay-status.refunded { color: #ff9f0a; }
@media (max-width: 860px) {
  .pay-grid { grid-template-columns: 1fr; }
  .pay-history li { grid-template-columns: 1fr auto; }
}

/* ---------------------------------------------------------------- legal pages */
.legal { max-width: 820px; margin: 24px auto 0; padding: 34px 36px; }
.legal h1 { font-size: 32px; margin-top: 0; }
.legal h2 { font-size: 20px; margin: 30px 0 8px; color: var(--gold); }
.legal p, .legal li { color: var(--dim); line-height: 1.95; }
.legal .updated { color: var(--muted); font-size: 13px; }
@media (max-width: 640px) { .legal { padding: 24px 20px; } }
