:root {
  --navy: #0B1F3A;
  --orange: #F26334;
  --paper: #F7F4EF;
  --muted: #5B6B7F;
  --line: rgba(11, 31, 58, 0.12);
  --surface: rgba(255, 255, 255, 0.92);
  --shadow: 0 18px 40px rgba(11, 31, 58, 0.08);
  --font: "Vazirmatn", "IBM Plex Sans", sans-serif;
  --status-blue: #2563EB;
  --status-orange: #EA580C;
  --status-green: #059669;
  --status-gray: #64748B;
  --status-red: #DC2626;
}

@media (prefers-color-scheme: dark) {
  :root {
    --navy: #E8EDF5;
    --paper: #0F1724;
    --muted: #94A3B8;
    --line: rgba(255, 255, 255, 0.1);
    --surface: rgba(22, 32, 48, 0.95);
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  }
  body.customer-body {
    background:
      radial-gradient(900px 420px at 100% -10%, rgba(242, 99, 52, 0.12), transparent 55%),
      linear-gradient(180deg, #0B1220, var(--paper));
  }
  .stack-form input,
  .stack-form select,
  .stack-form textarea,
  .phone-row input {
    background: #1E293B;
    color: var(--navy);
  }
}

* { box-sizing: border-box; }

body.customer-body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--navy);
  background:
    radial-gradient(900px 420px at 100% -10%, rgba(242, 99, 52, 0.18), transparent 55%),
    linear-gradient(180deg, #EDE8DF, var(--paper));
}

body.drawer-open { overflow: hidden; }

.customer-shell {
  width: min(720px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 2rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.customer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 30;
}

.brand {
  text-decoration: none;
  color: inherit;
  display: inline-flex;
  gap: 0.55rem;
  align-items: center;
  font-size: 1.2rem;
  font-weight: 700;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
}

.brand-text {
  display: flex;
  gap: 0.35rem;
  align-items: baseline;
}

.brand-en {
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--orange);
}

.panel-label {
  color: var(--muted);
  font-size: 0.92rem;
}

.menu-toggle {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--navy);
  border-radius: 2px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 31, 58, 0.45);
  z-index: 40;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(300px, 85vw);
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);
  z-index: 50;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.drawer-head {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1rem;
}

.drawer-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}

.drawer-menu > li {
  margin-bottom: 0.35rem;
}

.drawer-menu a {
  display: block;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  color: var(--navy);
  text-decoration: none;
  font-weight: 600;
}

.drawer-menu a:hover,
.drawer-menu a:focus {
  background: rgba(242, 99, 52, 0.1);
}

.drawer-menu .stub {
  opacity: 0.55;
  cursor: default;
}

.drawer-menu .submenu > span {
  display: block;
  padding: 0.65rem 0.75rem;
  font-weight: 700;
  color: var(--muted);
  font-size: 0.85rem;
}

.drawer-menu .submenu ul {
  list-style: none;
  margin: 0;
  padding: 0 0.5rem 0 0;
}

.drawer-logout {
  margin-top: 1rem;
  text-align: center;
}

.customer-main { flex: 1; }

.powered-footer {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
}

.powered-link {
  display: inline-flex;
  border-radius: 12px;
  overflow: hidden;
  line-height: 0;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
}

.powered-link img {
  width: min(180px, 48vw);
  height: auto;
  display: block;
}

.auth-card,
.panel-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 1.6rem;
  box-shadow: var(--shadow);
}

.auth-card.wide,
.panel-card { padding: 1.8rem; }

.auth-card h1,
.page-header h1 {
  margin: 0 0 0.6rem;
  font-size: 1.45rem;
}

.page-header {
  margin-bottom: 1.25rem;
}

.lead {
  margin: 0 0 1.25rem;
  color: var(--muted);
  line-height: 1.7;
}

.meta {
  margin: -0.5rem 0 1.25rem;
  color: var(--orange);
  font-weight: 600;
}

.stack-form {
  display: grid;
  gap: 0.75rem;
}

.stack-form label,
fieldset legend {
  font-weight: 600;
  font-size: 0.92rem;
}

.stack-form input,
.stack-form select,
.stack-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
  font: inherit;
  background: #fff;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
}

.phone-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.phone-prefix {
  display: flex;
  align-items: center;
  padding: 0 0.85rem;
  background: rgba(11, 31, 58, 0.05);
  font-weight: 700;
  color: var(--muted);
  border-left: 1px solid var(--line);
}

.phone-row input {
  border: 0;
  border-radius: 0;
  flex: 1;
}

.checkbox-row {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  font-weight: 500;
  line-height: 1.6;
}

.checkbox-row input { width: auto; margin-top: 0.2rem; }

.checkbox-grid {
  display: grid;
  gap: 0.5rem;
}

.otp-boxes {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.otp-digit {
  width: 56px;
  height: 56px;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.otp-digit:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(242, 99, 52, 0.2);
}

.btn {
  border: 0;
  border-radius: 999px;
  min-height: 48px;
  padding: 0.75rem 1.2rem;
  background: var(--orange);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:hover { filter: brightness(0.96); }

.btn-sm {
  min-height: 38px;
  padding: 0.45rem 1rem;
  font-size: 0.88rem;
}

.btn-outline {
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--line);
}

.hint, .resend {
  margin-top: 1rem;
  text-align: center;
  color: var(--muted);
}

.hint a, .link-btn {
  color: var(--navy);
  font-weight: 600;
}

.link-btn {
  background: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
}

.flash {
  border-radius: 16px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}

.flash.ok {
  background: rgba(31, 111, 120, 0.12);
  color: #1F6F78;
}

.flash.err {
  background: rgba(180, 35, 24, 0.1);
  color: #B42318;
}

.flash.err p { margin: 0.2rem 0; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.summary-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.summary-card.clickable:hover,
.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 44px rgba(11, 31, 58, 0.12);
}

.card-label {
  font-size: 0.88rem;
  color: var(--muted);
}

.card-value {
  font-size: 1.6rem;
  color: var(--orange);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.panel-head h2,
.panel-card h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

.ticket-list,
.data-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ticket-item,
.data-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}

.ticket-item:last-child,
.data-row:last-child { border-bottom: 0; }

.ticket-meta {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.data-main { flex: 1; }

.data-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.tag {
  font-size: 0.78rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(11, 31, 58, 0.06);
  color: var(--muted);
}

.data-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.status-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  white-space: nowrap;
}

.status-blue { background: rgba(37, 99, 235, 0.12); color: var(--status-blue); }
.status-orange { background: rgba(234, 88, 12, 0.12); color: var(--status-orange); }
.status-green { background: rgba(5, 150, 105, 0.12); color: var(--status-green); }
.status-gray { background: rgba(100, 116, 139, 0.12); color: var(--status-gray); }
.status-red { background: rgba(220, 38, 38, 0.12); color: var(--status-red); }

.skeleton-list { position: relative; }

.skeleton-row {
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(11,31,58,0.06) 25%, rgba(11,31,58,0.12) 50%, rgba(11,31,58,0.06) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  margin-bottom: 0.65rem;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 1rem 0;
}

.balance-card {
  background: linear-gradient(135deg, var(--navy), #1a3a5c);
  color: #fff;
  border-radius: 24px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: var(--shadow);
}

.balance-card strong {
  font-size: 1.5rem;
  color: var(--orange);
}

.type-picker { border: 0; padding: 0; margin: 0; }

.type-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 1rem;
  border: 2px solid var(--line);
  border-radius: 18px;
  cursor: pointer;
  font-weight: 600;
  transition: border-color 0.15s;
}

.type-card input { display: none; }

.type-card:has(input:checked) {
  border-color: var(--orange);
  background: rgba(242, 99, 52, 0.08);
}

.type-icon { font-size: 1.8rem; }

.map-box {
  height: 240px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.pagination-wrap {
  margin-top: 1rem;
}

@media (max-width: 640px) {
  .grid-2,
  .grid-3,
  .cards-grid,
  .type-options {
    grid-template-columns: 1fr;
  }

  .data-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .data-actions {
    flex-direction: row;
    align-items: center;
  }
}
