/* ==========================================================================
   Design tokens
   ========================================================================== */
@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  /* color: lapis / turquoise / saffron */
  --bg: #0b1129;
  --bg-raised: #101838;
  --surface: #151e45;
  --surface-2: #1d2859;
  --line: rgba(190, 205, 255, .12);
  --line-strong: rgba(190, 205, 255, .24);
  --text: #eef1fb;
  --muted: #9ca8d2;
  --brand: #22d3be;
  --brand-hover: #4fe3d1;
  --on-brand: #04332d;
  --brand-soft: rgba(34, 211, 190, .14);
  --accent: #f6b73c;
  --accent-soft: rgba(246, 183, 60, .15);
  --danger: #ff7b88;
  --danger-soft: rgba(255, 123, 136, .14);
  --info: #8ea2ff;
  --info-soft: rgba(142, 162, 255, .16);
  --focus: #f6b73c;

  /* type */
  --font: "Vazirmatn", system-ui, "Segoe UI", Tahoma, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --fs-sm: .875rem;
  --fs-md: 1rem;
  --fs-lg: 1.175rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2.1rem;
  --fs-hero: clamp(2.1rem, 5.2vw, 3.7rem);

  /* space, radius, motion */
  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem; --s5: 1.5rem; --s6: 2rem; --s7: 3rem; --s8: 5rem;
  --r-sm: 8px; --r-md: 14px; --r-lg: 24px; --r-pill: 999px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ring: 0 0 0 1px var(--line);
  --lift: 0 18px 50px -24px rgba(0, 0, 0, .7);
}

[data-theme="light"] {
  --bg: #f5f7fd;
  --bg-raised: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef1fb;
  --line: rgba(20, 30, 80, .1);
  --line-strong: rgba(20, 30, 80, .22);
  --text: #0f1634;
  --muted: #566088;
  --brand: #0fb5a1;
  --brand-hover: #0b9c8a;
  --on-brand: #ffffff;
  --brand-soft: rgba(15, 181, 161, .12);
  --accent: #b9770e;
  --accent-soft: rgba(246, 183, 60, .22);
  --danger: #d6354a;
  --danger-soft: rgba(214, 53, 74, .1);
  --info: #4357d8;
  --info-soft: rgba(67, 87, 216, .1);
  --focus: #4357d8;
  --lift: 0 18px 40px -26px rgba(20, 30, 80, .35);
}

@counter-style fa-digits { system: numeric; symbols: "۰" "۱" "۲" "۳" "۴" "۵" "۶" "۷" "۸" "۹"; }

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 400 var(--fs-md)/1.95 var(--font);
}
main { flex: 1; }
h1, h2, h3 { line-height: 1.45; margin: 0 0 var(--s3); font-weight: 800; letter-spacing: -.01em; }
p { margin: 0 0 var(--s4); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: var(--r-sm); }
.ltr { direction: ltr; unicode-bidi: plaintext; text-align: left; font-family: var(--mono); }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.container { width: min(1160px, 100% - 2.5rem); margin-inline: auto; }
svg.icon { flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ==========================================================================
   Components: button
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 46px; padding: 0 var(--s5); border-radius: var(--r-pill);
  border: 1px solid transparent; font: 700 var(--fs-md)/1 var(--font); cursor: pointer;
  transition: background .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn-danger:hover { border-color: var(--danger); }
.btn-sm { min-height: 36px; padding: 0 var(--s4); font-size: var(--fs-sm); }
.btn-lg { min-height: 54px; padding: 0 var(--s6); font-size: var(--fs-lg); }
.btn-icon { min-height: 40px; width: 40px; padding: 0; }
.inline-form { display: inline; margin: 0; }

/* field */
.field { margin-bottom: var(--s4); }
.field label { display: block; font-weight: 600; font-size: var(--fs-sm); margin-bottom: var(--s2); }
.input {
  width: 100%; min-height: 50px; padding: 0 var(--s4); border-radius: var(--r-md);
  background: var(--bg-raised); color: var(--text); border: 1px solid var(--line-strong);
  font: 500 var(--fs-md) var(--font); transition: border-color .2s, box-shadow .2s;
}
.input:hover { border-color: var(--muted); }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.hint { color: var(--muted); font-size: var(--fs-sm); margin-top: var(--s2); }
.field-error { color: var(--danger); font-size: var(--fs-sm); margin-top: var(--s2); }
.input-group { position: relative; }
.input-group .btn-icon { position: absolute; inset-block: 5px; inset-inline-end: 5px; min-height: 40px; }
.input-group .input { padding-inline-end: 56px; }
textarea.input { padding: var(--s3) var(--s4); min-height: 80px; resize: vertical; }

/* badge */
.badge {
  display: inline-flex; align-items: center; gap: .45rem; padding: .2rem .8rem; border-radius: var(--r-pill);
  font-size: var(--fs-sm); font-weight: 700; line-height: 1.7; background: var(--info-soft); color: var(--info);
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-active { background: var(--brand-soft); color: var(--brand); }
.badge-pending { background: var(--accent-soft); color: var(--accent); }
.badge-provisioning { background: var(--info-soft); color: var(--info); }
.badge-provisioning::before { animation: pulse 1.4s ease-in-out infinite; }
.badge-failed, .badge-rejected { background: var(--danger-soft); color: var(--danger); }

/* flash */
.flashes { display: grid; gap: var(--s3); margin-block: var(--s4); }
.flash { padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--info-soft); color: var(--text); border-inline-start: 4px solid var(--info); }
.flash-success { background: var(--brand-soft); border-color: var(--brand); }
.flash-error { background: var(--danger-soft); border-color: var(--danger); }

/* card & panel */
.panel { background: var(--surface); border-radius: var(--r-lg); padding: var(--s5); box-shadow: var(--ring); }
.panel-flat { background: transparent; border-block: 1px solid var(--line); border-radius: 0; box-shadow: none; }

/* ==========================================================================
   Layout: header / footer
   ========================================================================== */
.site-header { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px); background: color-mix(in srgb, var(--bg) 82%, transparent); border-bottom: 1px solid var(--line); }
.site-header .container { display: flex; align-items: center; gap: var(--s5); min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: var(--s3); font-weight: 800; font-size: var(--fs-lg); color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; }
.nav { display: flex; gap: var(--s5); margin-inline-start: var(--s4); }
.nav a { color: var(--muted); font-weight: 600; font-size: var(--fs-sm); }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); text-decoration: none; }
.header-actions { margin-inline-start: auto; display: flex; align-items: center; gap: var(--s3); }
.site-footer { border-top: 1px solid var(--line); padding-block: var(--s6); color: var(--muted); font-size: var(--fs-sm); margin-top: var(--s8); }
.site-footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--s3); }

/* ==========================================================================
   Landing
   ========================================================================== */
.hero { position: relative; padding-block: var(--s8) var(--s7); overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(60% 60% at 15% 10%, rgba(34, 211, 190, .16), transparent 70%),
    radial-gradient(50% 50% at 90% 0%, rgba(246, 183, 60, .10), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='88' viewBox='0 0 88 88'%3E%3Cg fill='none' stroke='%2322d3be' stroke-opacity='.13'%3E%3Crect x='22' y='22' width='44' height='44'/%3E%3Crect x='22' y='22' width='44' height='44' transform='rotate(45 44 44)'/%3E%3C/g%3E%3C/svg%3E");
  -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent 95%);
  mask-image: linear-gradient(to bottom, #000 30%, transparent 95%);
}
.hero .container { position: relative; display: grid; grid-template-columns: 1.15fr .85fr; gap: var(--s7); align-items: center; }
.hero h1 { font-size: var(--fs-hero); font-weight: 900; line-height: 1.38; margin-bottom: var(--s4); }
.hero .lead { font-size: var(--fs-lg); color: var(--muted); max-width: 34rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s5); }
.hero-note { margin-top: var(--s4); color: var(--muted); font-size: var(--fs-sm); display: flex; gap: var(--s2); align-items: center; }

/* the memorable thing: provisioning ticket */
.ticket { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--ring), var(--lift); overflow: hidden; }
.ticket-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s5); background: var(--bg-raised); border-bottom: 1px solid var(--line); }
.ticket-domain { font-family: var(--mono); font-weight: 600; direction: ltr; color: var(--brand); }
.ticket-body { padding: var(--s5); display: grid; gap: var(--s4); }
.ticket-row { display: grid; grid-template-columns: 28px 1fr auto; gap: var(--s3); align-items: center; color: var(--muted); transition: color .4s; }
.ticket-dot { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; transition: all .4s var(--ease); }
.ticket-dot .icon { width: 14px; height: 14px; opacity: 0; stroke-width: 2.6; }
.ticket-row[data-state="active"] { color: var(--text); }
.ticket-row[data-state="active"] .ticket-dot { border-color: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); animation: pulse 1.4s ease-in-out infinite; }
.ticket-row[data-state="done"] { color: var(--text); }
.ticket-row[data-state="done"] .ticket-dot { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.ticket-row[data-state="done"] .ticket-dot .icon { opacity: 1; }
.ticket-time { font-size: var(--fs-sm); font-family: var(--mono); direction: ltr; }
.ticket-foot { padding: var(--s4) var(--s5); border-top: 1px dashed var(--line-strong); display: flex; justify-content: space-between; align-items: center; gap: var(--s3); font-size: var(--fs-sm); color: var(--muted); }
.ticket-foot .ltr { color: var(--text); }

.section { padding-block: var(--s7); }
.section-head { max-width: 40rem; margin-bottom: var(--s6); }
.section-head h2 { font-size: var(--fs-2xl); }
.section-head p { color: var(--muted); }

.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s5); counter-reset: step; }
.steps li { position: relative; padding-top: var(--s5); border-top: 2px solid var(--line-strong); counter-increment: step; }
.steps li::before { content: ""; position: absolute; inset-inline-start: 0; top: -2px; width: 36%; height: 2px; background: var(--brand); }
.steps li::after { content: counter(step, fa-digits); display: block; font-size: var(--fs-sm); color: var(--brand); font-weight: 800; order: -1; }
.steps li { display: flex; flex-direction: column; }
.steps h3 { font-size: var(--fs-lg); margin: var(--s2) 0; }
.steps p { color: var(--muted); font-size: var(--fs-sm); margin: 0; }

.specs { display: grid; grid-template-columns: 1fr 1fr; column-gap: var(--s7); }
.spec { display: grid; grid-template-columns: 44px 1fr; gap: var(--s4); padding-block: var(--s5); border-top: 1px solid var(--line); }
.spec-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.spec h3 { font-size: var(--fs-lg); margin-bottom: var(--s1); }
.spec p { margin: 0; color: var(--muted); font-size: var(--fs-sm); }

.faq { max-width: 48rem; }
.faq details { border-top: 1px solid var(--line); padding-block: var(--s4); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: var(--s4); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--brand); font-size: 1.4rem; line-height: 1.3; transition: transform .25s var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: var(--s3) 0 0; color: var(--muted); }

.cta-band { display: flex; align-items: center; justify-content: space-between; gap: var(--s5); flex-wrap: wrap; padding: var(--s6); border-radius: var(--r-lg); background: linear-gradient(120deg, var(--surface-2), var(--surface)); box-shadow: var(--ring); }
.cta-band h2 { margin: 0; font-size: var(--fs-xl); }

/* ==========================================================================
   Auth
   ========================================================================== */
.auth { display: grid; grid-template-columns: minmax(0, 460px) 1fr; gap: var(--s7); align-items: stretch; padding-block: var(--s7); }
.auth-card h1 { font-size: var(--fs-xl); }
.auth-aside { border-radius: var(--r-lg); padding: var(--s6); background: linear-gradient(160deg, var(--surface-2), var(--surface)); box-shadow: var(--ring); display: flex; flex-direction: column; justify-content: center; gap: var(--s4); }
.auth-aside ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); color: var(--muted); }
.auth-aside li { display: flex; gap: var(--s3); align-items: flex-start; }
.auth-aside li .icon { color: var(--brand); margin-top: .45rem; }

/* ==========================================================================
   App (account + admin)
   ========================================================================== */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; padding-block: var(--s6) var(--s5); }
.page-head h1 { font-size: var(--fs-2xl); margin: 0; }
.order-list { display: grid; gap: var(--s4); }
.order-row { display: grid; grid-template-columns: 1fr auto auto; gap: var(--s4); align-items: center; padding: var(--s4) var(--s5); background: var(--surface); border-radius: var(--r-md); box-shadow: var(--ring); color: var(--text); transition: box-shadow .2s; }
.order-row:hover { text-decoration: none; box-shadow: 0 0 0 1px var(--brand); }
.order-domain { font-family: var(--mono); font-weight: 600; direction: ltr; text-align: start; }
.empty { text-align: center; padding: var(--s7) var(--s5); border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg); }
.empty h2 { font-size: var(--fs-xl); }
.empty p { color: var(--muted); }

.stepper { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s3); }
.stepper li { padding-top: var(--s3); border-top: 4px solid var(--line-strong); border-radius: 2px; color: var(--muted); font-size: var(--fs-sm); font-weight: 600; }
.stepper li.done { border-color: var(--brand); color: var(--text); }
.stepper li.current { border-color: var(--accent); color: var(--text); }
.stepper li.error { border-color: var(--danger); color: var(--danger); }

.two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: var(--s5); align-items: start; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: var(--s3) var(--s5); margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.cred-row { display: grid; gap: var(--s2); margin-bottom: var(--s4); }
.cred-row label { font-size: var(--fs-sm); color: var(--muted); font-weight: 600; }

.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--s3); margin-bottom: var(--s5); }
.stat { padding: var(--s4); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--ring); }
.stat strong { display: block; font-size: var(--fs-xl); font-weight: 900; line-height: 1.4; }
.stat span { color: var(--muted); font-size: var(--fs-sm); }
.tabs { display: flex; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s4); }
.tab { padding: .35rem 1rem; border-radius: var(--r-pill); color: var(--muted); font-weight: 600; font-size: var(--fs-sm); border: 1px solid var(--line); }
.tab[aria-current="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.tab:hover { text-decoration: none; border-color: var(--line-strong); }
.table-wrap { overflow-x: auto; border-radius: var(--r-md); box-shadow: var(--ring); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th, .table td { padding: var(--s3) var(--s4); text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; background: var(--bg-raised); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.row-actions { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.reject-box summary { cursor: pointer; list-style: none; }
.reject-box summary::-webkit-details-marker { display: none; }
.reject-box form { margin-top: var(--s2); display: grid; gap: var(--s2); min-width: 220px; }
.err-note { color: var(--danger); font-size: var(--fs-sm); }

/* ==========================================================================
   Motion + responsive
   ========================================================================== */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (max-width: 960px) {
  .hero .container, .auth, .two-col, .specs { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .nav { display: none; }
  .auth-aside { order: 2; }
}
@media (max-width: 560px) {
  .hero { padding-block: var(--s7) var(--s6); }
  .steps, .stepper { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .order-row { grid-template-columns: 1fr auto; }
  .order-row .order-date { display: none; }
  .header-actions .btn-ghost.hide-sm { display: none; }
}

/* brand mark */
.brand-mark .bm-a { fill: none; stroke: var(--brand); stroke-width: 2.2; }
.brand-mark .bm-b { fill: var(--accent); opacity: .92; }
