* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

input, button { touch-action: manipulation; }

:root {
  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;
  --green-50: #f0fdf4;
  --ink: #16281d;
  --muted: #5f7367;
  --line: #e2ebe5;
  --red: #dc2626;
}

html {
  background: linear-gradient(165deg, #060f09 0%, #0b1a11 55%, #0d2314 100%);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: "Vazirmatn", Tahoma, sans-serif;
  color: var(--ink);
  overflow-x: hidden;
  overflow-wrap: break-word;
  background:
    radial-gradient(640px 420px at 88% -8%, rgba(34, 197, 94, 0.16), transparent 60%),
    radial-gradient(720px 520px at -12% 108%, rgba(22, 163, 74, 0.14), transparent 60%);
}

.container { width: min(640px, 92%); margin-inline: auto; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(6, 15, 9, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 0;
  padding-top: calc(14px + env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--green-400), var(--green-700));
  color: #fff;
  box-shadow: 0 8px 22px rgba(34, 197, 94, 0.35);
}
.brand-text { display: flex; flex-direction: column; }
.brand-text strong { color: #fff; font-size: 0.98rem; }
.brand-text span { color: #8fa89a; font-size: 0.74rem; }
.header-badge {
  color: var(--green-400);
  font-size: 0.74rem;
  border: 1px solid rgba(74, 222, 128, 0.35);
  background: rgba(34, 197, 94, 0.08);
  padding: 5px 12px;
  border-radius: 999px;
}

main.container { flex: 1; padding: 40px 0 56px; }

.card {
  background: #fff;
  border-top: 4px solid var(--green-500);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.35);
}
.step { display: none; }
.step.is-active { display: block; animation: rise 0.35s ease both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
.card h1 { margin: 0 0 6px; font-size: 1.3rem; }
.step-desc { margin: 0 0 20px; color: var(--muted); font-size: 0.9rem; line-height: 1.9; }
.highlight { color: var(--green-700); }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.84rem; font-weight: 700; margin-bottom: 6px; }
.field input {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: 13px 14px;
  min-height: 48px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #f7faf8;
  color: var(--ink);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.field input:focus {
  border-color: var(--green-500);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
}
.field input::placeholder { color: #a9bab0; }
.field.has-error input { border-color: var(--red); box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.09); }
.field-error { display: none; margin: 6px 2px 0; color: var(--red); font-size: 0.76rem; }
.field.has-error .field-error { display: block; }
.hint { margin: 14px 2px 0; color: var(--muted); font-size: 0.76rem; line-height: 1.8; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.btn {
  font: inherit;
  font-weight: 700;
  border: none;
  cursor: pointer;
  border-radius: 12px;
  padding: 13px 18px;
  min-height: 48px;
  -webkit-appearance: none;
  appearance: none;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s, border-color 0.2s;
}
.btn:focus-visible { outline: 3px solid rgba(34, 197, 94, 0.4); outline-offset: 2px; }
.btn-block { display: block; width: 100%; }
.btn-primary {
  background: linear-gradient(135deg, var(--green-500), var(--green-600));
  color: #fff;
  box-shadow: 0 10px 24px rgba(22, 163, 74, 0.32);
}
.btn-primary:active { transform: scale(0.98); box-shadow: 0 6px 16px rgba(22, 163, 74, 0.3); }
.btn-ghost {
  margin-top: 10px;
  background: transparent;
  color: var(--green-700);
  border: 1.5px solid rgba(22, 163, 74, 0.35);
}
.btn-ghost:active { transform: scale(0.98); background: var(--green-50); }
.btn-logout {
  margin-inline-start: auto;
  background: #fdf3f3;
  color: #b91c1c;
  border: 1px solid #f5d5d5;
  padding: 9px 14px;
  font-size: 0.8rem;
  border-radius: 10px;
}
.btn-logout:active { transform: scale(0.96); }
@media (hover: hover) {
  .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(22, 163, 74, 0.4); }
  .btn-ghost:hover { background: var(--green-50); border-color: var(--green-500); }
  .btn-logout:hover { background: #fdeaea; }
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 20px;
  margin-bottom: 22px;
  border-bottom: 1px dashed var(--line);
}
.avatar {
  width: 54px;
  height: 54px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--green-400), var(--green-700));
  color: #fff;
  font-size: 1.35rem;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(22, 163, 74, 0.35);
}
.panel-titles { min-width: 0; }
.panel-titles h1 { margin-bottom: 2px; }
.panel-titles .step-desc { margin-bottom: 3px; }
.panel-phone-line { margin: 0; color: var(--muted); font-size: 0.79rem; }
.panel-phone-line span { color: var(--green-700); font-weight: 700; }

.empty-state {
  border: 2px dashed #d6e4db;
  border-radius: 16px;
  background: #fafdfb;
  padding: 42px 20px;
  text-align: center;
  color: var(--muted);
}
.empty-state svg { width: 46px; height: 46px; color: #9db8a9; margin-bottom: 12px; }
.empty-title { margin: 0 0 6px; font-weight: 700; color: var(--ink); }
.empty-desc { margin: 0; font-size: 0.84rem; line-height: 1.9; }

.panel-sections { display: flex; flex-direction: column; gap: 26px; }
.panel-section h2 { margin: 0 0 12px; font-size: 1.05rem; }
.muted-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  border: 2px dashed #d6e4db;
  border-radius: 14px;
  background: #fafdfb;
  padding: 22px 16px;
  text-align: center;
}

.comp-card, .reg-card {
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.comp-card:hover { border-color: rgba(34, 197, 94, 0.5); box-shadow: 0 8px 20px rgba(22, 163, 74, 0.08); }
.comp-main { display: flex; gap: 12px; align-items: flex-start; }
.comp-logo {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: var(--green-50);
}
.comp-logo--ph {
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--green-700);
}
.comp-info { min-width: 0; flex: 1; }
.comp-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.comp-title-row h3 { margin: 0; font-size: 0.98rem; }
.comp-line { margin: 2px 0; color: var(--muted); font-size: 0.8rem; line-height: 1.8; }
.comp-line b { color: var(--ink); }
.comp-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.comp-actions .btn-sm { flex: 1; }

.reg-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.reg-head b { font-size: 0.95rem; }
.track-inline { color: var(--green-700); letter-spacing: 1px; }

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge--open, .badge--paid { background: var(--green-50); color: var(--green-700); border: 1px solid rgba(22, 163, 74, 0.35); }
.badge--closed, .badge--failed { background: #fdf3f3; color: #b91c1c; border: 1px solid #f5d5d5; }
.badge--pending { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 10, 6, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: 18px;
  backdrop-filter: blur(4px);
}
.modal-overlay.is-open { display: flex; }
.modal {
  background: #fff;
  border-radius: 20px;
  border-top: 4px solid var(--green-500);
  padding: 26px 24px;
  width: min(520px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
  animation: rise 0.3s ease both;
}
.modal-close {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f7faf8;
  color: var(--muted);
  font-size: 1.15rem;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { background: var(--green-50); color: var(--green-700); }
.modal h2 { margin: 12px 0 10px; font-size: 1.15rem; }
.comp-logo-lg {
  display: block;
  width: 84px;
  height: 84px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid var(--line);
}
.comp-meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0 14px; }
.comp-meta-grid div {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fafdfb;
}
.comp-meta-grid span { display: block; font-size: 0.68rem; color: var(--muted); margin-bottom: 2px; }
.comp-meta-grid b { font-size: 0.82rem; }
.comp-body h3 { margin: 14px 0 6px; font-size: 0.9rem; color: var(--green-700); }
.comp-body p { margin: 0; color: var(--muted); font-size: 0.85rem; line-height: 2; white-space: pre-line; }
.modal .btn-block { margin-top: 18px; }

.btn-danger { background: #fdf3f3; color: #b91c1c; border: 1px solid #f5d5d5; }
.btn-danger:hover { background: #fdeaea; }
.btn-sm { padding: 8px 14px; min-height: 40px; font-size: 0.82rem; border-radius: 10px; }

.admin-topbar {
  width: min(1080px, 94%);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  padding-top: calc(12px + env(safe-area-inset-top));
  flex-wrap: wrap;
}
.brand-logo--admin { background: linear-gradient(135deg, #fbbf24, #d97706); box-shadow: 0 8px 22px rgba(217, 119, 6, 0.35); }
.admin-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.admin-nav a {
  color: #a7bfb1;
  text-decoration: none;
  font-size: 0.84rem;
  padding: 8px 14px;
  border-radius: 10px;
  transition: background 0.2s, color 0.2s;
}
.admin-nav a:hover, .admin-nav a.is-active { background: rgba(34, 197, 94, 0.12); color: var(--green-400); }
.admin-nav a.admin-logout { color: #fca5a5; }
.admin-nav a.admin-logout:hover { background: rgba(239, 68, 68, 0.12); }

.admin-wrap { width: min(1080px, 94%); margin-inline: auto; padding: 26px 0 60px; flex: 1; }
.admin-flash {
  background: var(--green-50);
  color: var(--green-700);
  border: 1px solid rgba(22, 163, 74, 0.35);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}
.admin-flash--err { background: #fdf3f3; color: #b91c1c; border-color: #f5d5d5; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat-card {
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: #fafdfb;
}
.stat-card span { display: block; font-size: 0.74rem; color: var(--muted); margin-bottom: 4px; }
.stat-card b { font-size: 1.1rem; }

.table-head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.table-head-row h2 { margin: 0; font-size: 1.05rem; }
.table-scroll { overflow-x: auto; border: 1.5px solid var(--line); border-radius: 14px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.83rem; min-width: 680px; }
.admin-table th {
  text-align: right;
  background: #f2f8f4;
  color: var(--green-700);
  padding: 10px 12px;
  font-size: 0.76rem;
  border-bottom: 1.5px solid var(--line);
  white-space: nowrap;
}
.admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: #fafdfb; }
.td-title { font-weight: 700; }
.td-dates { font-size: 0.76rem; color: var(--muted); line-height: 1.8; white-space: nowrap; }
.td-empty { text-align: center; color: var(--muted); padding: 26px !important; }
.td-actions { display: flex; gap: 6px; align-items: center; }
.t-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
}
.t-logo--ph { color: var(--muted); }
.dates-title { margin: 6px 0 12px; font-size: 0.92rem; color: var(--green-700); }
.jdt { display: flex; gap: 6px; align-items: center; }
.jdt input, .jdt select {
  font: inherit;
  font-size: 0.88rem;
  padding: 9px 8px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #f7faf8;
  color: var(--ink);
  min-width: 0;
}
.jdt-y { width: 74px; }
.jdt-m { flex: 1; min-width: 90px; }
.jdt-d { width: 56px; }
.jdt-t { width: 92px; direction: ltr; }
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  margin: 4px 0 18px;
  cursor: pointer;
}
.check-row input { width: 18px; height: 18px; accent-color: var(--green-600); }
.logo-preview {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-bottom: 8px;
}
textarea { resize: vertical; }

.pay-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.8rem;
  font-weight: 800;
  margin: 0 auto 14px;
}
.pay-icon--ok { background: var(--green-50); color: var(--green-600); border: 2px solid rgba(34, 197, 94, 0.4); }
.pay-icon--err { background: #fdf3f3; color: #b91c1c; border: 2px solid #f5d5d5; }
.pay-meta { color: var(--muted); font-size: 0.88rem; margin: 6px 0; }
.track-code {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--green-700);
  background: var(--green-50);
  border: 2px dashed rgba(34, 197, 94, 0.45);
  border-radius: 14px;
  padding: 14px;
  margin: 14px 0 18px;
}

.site-footer {
  background: rgba(5, 12, 8, 0.85);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: #7e948a;
  text-align: center;
  padding: calc(18px + env(safe-area-inset-bottom)) 0;
  font-size: 0.78rem;
}

.toast {
  position: fixed;
  bottom: calc(26px + env(safe-area-inset-bottom));
  right: 50%;
  transform: translate(50%, 16px);
  max-width: min(420px, 90vw);
  padding: 12px 22px;
  border-radius: 12px;
  background: #0f2418;
  color: #eafff2;
  border: 1px solid rgba(74, 222, 128, 0.4);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
  font-size: 0.87rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 60;
}
.toast.is-visible { opacity: 1; transform: translate(50%, 0); }
.toast--error { background: #2a1315; color: #ffe3e3; border-color: rgba(248, 113, 113, 0.5); }

@media (max-width: 560px) {
  .container { width: 94%; }
  main.container { padding: 28px 0 44px; }
  .card { padding: 26px 20px; }
  .card h1 { font-size: 1.18rem; }
  .step-desc { font-size: 0.88rem; }
  .brand-text span { display: none; }
  .header-badge { display: none; }
  .panel-head { flex-wrap: wrap; row-gap: 12px; }
  .avatar { width: 46px; height: 46px; font-size: 1.15rem; }
  .btn-logout { padding: 8px 12px; font-size: 0.78rem; }
}

@media (max-width: 400px) {
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .card { padding: 22px 16px; border-radius: 16px; }
  .brand-logo { width: 38px; height: 38px; border-radius: 11px; }
  .brand-logo svg { width: 19px; height: 19px; }
  .brand-text strong { font-size: 0.9rem; }
  .empty-state { padding: 32px 14px; }
  .btn { font-size: 0.95rem; }
  .comp-meta-grid { grid-template-columns: 1fr; }
  .jdt { flex-wrap: wrap; }
  .jdt-m { min-width: 100%; }
  .comp-actions .btn-sm { flex: 1 1 100%; }
}

@media (max-height: 480px) and (orientation: landscape) {
  main.container { padding: 14px 0 24px; }
  .card { padding: 18px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
