/* v99: owner-uploaded site font, served at /site-font when one is
   uploaded in the secret admin page; when none is uploaded the
   URL 404s and the browser falls back to the stacks below. */
@font-face {
  font-family: "SiteCustom";
  src: url("/site-font");
  font-display: swap;
}

/* reseller.css — quickbro reseller panel, dashboard edition.
   Same site tokens as the purchase pages (white, red #DD0C29
   accent, charcoal), but the panel is now a real dashboard:
   dark sidebar on desktop, sticky top bar + bottom tab bar on
   phones, and one view at a time (Dashboard / New Order /
   My Orders / Notifications / Profile) instead of everything
   stacked in a single narrow sheet. No build step, no
   framework. Uses the device's own system font. */

:root {
  --sky: #FFFFFF;
  --blue: #DD0C29;
  --blue-soft: rgba(221, 12, 41, 0.12);
  --navy: #000000;
  --ink: #101010;
  --muted: #6E6E6E;
  --line: rgba(22, 22, 22, 0.1);
  --err: #dc2626;
  --ok: #1a7f37;
  --bg: #F3F4F6;
  --card: #FFFFFF;
  --sidebar: #101010;
  --sidebar-ink: #F5F5F5;
  --sidebar-muted: #9C9C9C;
  --radius: 18px;
  --sidebar-w: 250px;
  --topbar-h: 60px;
  --bottomnav-h: 64px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  background: linear-gradient(180deg, rgba(221, 12, 41, 0.22) 0%, rgba(221, 12, 41, 0.06) 25%, #FFFFFF 50%, rgba(221, 12, 41, 0.10) 80%, rgba(221, 12, 41, 0.20) 100%);
  background-attachment: fixed;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "SiteCustom", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

input, select, textarea, button {
  font-family: inherit;
}

/* v96: the 3D-style canvas sits fixed behind everything. */
#bg-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

main {
  position: relative;
  z-index: 1;
}

.loading {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin-top: 48px;
}

/* ---------- login card (unchanged layout, centred sheet) ---------- */

.sheet {
  max-width: 480px;
  margin: 0 auto;
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 20px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
}

/* The login sheet is the only thing in #app before login, and
   <main> carries no padding of its own — the sheet brings its
   own top spacing. */
#app > .sheet {
  margin-top: max(24px, env(safe-area-inset-top));
}

.sheet h1 {
  text-align: center;
  font-size: 28px;
  margin: 0 0 6px;
}

.sub {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 20px;
}

/* ---------- app shell ---------- */

.app-shell {
  min-height: 100vh;
}

/* Sidebar: desktop only. */
.sidebar {
  display: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.brand img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex: none;
}

.brand-name {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-tag {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: var(--blue);
  border-radius: 999px;
  padding: 3px 8px;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
}

.icon-btn:active {
  transform: scale(0.96);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.nav-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  border: 2px solid #fff;
}

.nav-badge[hidden] {
  display: none;
}

/* Bottom tab bar: phones only. */
.bottomnav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottomnav .nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 0 8px;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.bottomnav .nav-item svg {
  width: 22px;
  height: 22px;
}

.bottomnav .nav-item.active {
  color: var(--blue);
}

.bottomnav .nav-item.active::before {
  content: "";
  width: 22px;
  height: 3px;
  border-radius: 999px;
  background: var(--blue);
  margin-bottom: -1px;
}

/* Content area. */
.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px 16px calc(var(--bottomnav-h) + 28px);
}

.view[hidden] {
  display: none;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin: 6px 0 18px;
}

.page-head h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}

.page-sub {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 6px 0 0;
}

/* Compact red pill button (dashboard CTA, small actions). */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  padding: 0 18px;
  background: var(--blue);
  color: #fff;
  border: 0;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn.ghost {
  background: #fff;
  color: var(--blue);
  border: 2px solid var(--blue);
}

/* ---------- dashboard ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
}

.stat-icon svg {
  width: 20px;
  height: 20px;
}

.stat-icon.red { background: var(--blue-soft); color: var(--blue); }
.stat-icon.green { background: rgba(26, 127, 55, 0.12); color: var(--ok); }
.stat-icon.amber { background: rgba(154, 103, 0, 0.12); color: #9a6700; }
.stat-icon.grey { background: rgba(113, 124, 130, 0.14); color: var(--muted); }

.stat-num {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  margin-top: 5px;
}

.dash-grid {
  display: grid;
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.card-head h2,
.card h2 {
  font-size: 18px;
  font-weight: 800;
  margin: 0;
}

.card-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin: 10px 0 0;
}

.region-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.region-line:first-of-type {
  border-top: 0;
}

.region-line .r-name {
  font-weight: 700;
}

.region-line .r-note {
  color: var(--muted);
  font-size: 12px;
  display: block;
  margin-top: 2px;
}

/* ---------- forms, plan cards, methods (kept from before) ---------- */

.order-head {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 8px;
  margin: 0 0 6px;
}

.order-head h1 {
  margin: 0;
  text-align: left;
  font-size: 25px;
  white-space: nowrap;
  flex: none;
}

.order-head img {
  width: auto;
  height: auto;
  max-height: 19px;
  max-width: 40vw;
  flex: none;
}

@media (max-width: 350px) {
  .order-head h1 {
    font-size: 22px;
  }

  .order-head img {
    max-height: 16px;
  }

  .order-head {
    gap: 6px;
  }
}

.plan-cards {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.plan-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: #FFFFFF;
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  cursor: pointer;
}

.plan-card:active {
  transform: scale(0.98);
}

.plan-card.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(221, 12, 41, 0.12);
}

.plan-card.selected .pc-name {
  color: var(--blue);
}

.pc-left {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pc-name {
  font-weight: 700;
  font-size: 15px;
}

.pc-days {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.pc-price {
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.field {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-top: 14px;
}

.field .req {
  color: var(--err);
}

.field input,
.field select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 13px 14px;
  font-size: 16px;
  color: var(--navy);
  background: var(--sky);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(221, 12, 41, 0.2);
}

.pay-btn {
  width: 100%;
  height: 56px;
  margin-top: 20px;
  background: var(--blue);
  color: #fff;
  border: 0;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.pay-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.pay-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.ghost-btn {
  background: #FFFFFF;
  color: var(--blue);
  border: 2px solid var(--blue);
}

.error,
.notice {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  min-height: 20px;
  margin: 14px 0 0;
}

.error {
  color: var(--err);
}

.notice {
  color: var(--ok);
}

.error:empty,
.notice:empty {
  margin: 0;
}

/* Global status lines live above the views, so messages from
   any view (login, photo upload, payment) always have a home. */
.page .error,
.page .notice {
  margin-top: 0;
  margin-bottom: 10px;
}

.text-btn {
  background: none;
  border: 0;
  color: var(--blue);
  font-size: 14px;
  font-weight: 700;
  padding: 8px 4px;
  cursor: pointer;
  white-space: nowrap;
}

.section-title {
  font-size: 18px;
  margin: 28px 0 4px;
}

.total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 15px;
}

.total strong {
  font-size: 18px;
}

/* ---------- orders ---------- */

.filter-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin: 0 0 6px;
  scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.orders-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.orders-head .section-title {
  margin-top: 28px;
}

.orders-head .text-btn {
  margin-top: 28px;
}

.order-row {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.order-row .o-plan {
  font-weight: 700;
  font-size: 15px;
}

.order-row .o-meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.order-row .o-right {
  text-align: right;
  flex-shrink: 0;
}

.order-row .o-amount {
  font-weight: 700;
  font-size: 15px;
}

.pill {
  display: inline-block;
  margin-top: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.pill.paid {
  color: #1a7f37;
  background: rgba(26, 127, 55, 0.12);
}

.pill.verified {
  color: #1a7f37;
  background: rgba(26, 127, 55, 0.12);
}

.pill.pending {
  color: #9a6700;
  background: rgba(154, 103, 0, 0.12);
}

.pill.expired {
  color: var(--muted);
  background: rgba(113, 124, 130, 0.12);
}

.pill.declined {
  color: #c00;
  background: rgba(204, 0, 0, 0.12);
}

.empty-orders {
  color: var(--muted);
  font-size: 14px;
  margin-top: 10px;
}

/* ---------- profile ---------- */

.profile-card {
  max-width: 560px;
}

.profile-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-top .who {
  min-width: 0;
}

.profile-top .who b {
  display: block;
  font-size: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-top .who span {
  color: var(--muted);
  font-size: 13px;
}

.avatar-label {
  flex: none;
  cursor: pointer;
  line-height: 0;
}

.avatar {
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--blue);
  flex: none;
  cursor: pointer;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-initial {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.avatar.big {
  width: 72px;
  height: 72px;
}

.avatar.big .avatar-initial {
  font-size: 28px;
}

.profile-sep {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 20px 0;
}

.profile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
}

.profile-row .row-label {
  font-weight: 700;
  font-size: 15px;
}

.profile-row .row-sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

/* ---------- payment method cards ---------- */

.method-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.method {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  background: #FFFFFF;
  cursor: pointer;
}

.method.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(221, 12, 41, 0.12);
}

.method-head {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.method-head input {
  display: none;
}

.m-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--sky);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.m-icon img {
  max-width: 34px;
  max-height: 26px;
  object-fit: contain;
}

.m-text {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.m-title {
  font-weight: 700;
  font-size: 15px;
}

.m-amount {
  color: var(--muted);
  font-size: 13px;
}

.radio {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--line);
  flex-shrink: 0;
}

.method.active .radio {
  border-color: var(--blue);
  background: var(--blue);
  box-shadow: inset 0 0 0 4px #fff;
}

.method-body {
  margin-top: 10px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.method-body b {
  color: var(--navy);
}

.method-body .field {
  margin-top: 10px;
}

/* ---------- notifications ---------- */

.notif-item {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 10px;
  background: #fff;
}

.notif-item.unread {
  border-left: 4px solid #DD0C29;
}

.notif-msg {
  font-size: 14px;
  line-height: 1.5;
}

.notif-date {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

/* ---------- loaders (unchanged) ---------- */

.loader-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(245, 245, 245, 0.92);
  padding: 24px;
}

.loader-overlay[hidden] {
  display: none;
}

.loader-box {
  text-align: center;
}

.spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto;
  border: 4px solid rgba(221, 12, 41, 0.2);
  border-top-color: #DD0C29;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loader-title {
  font-size: 17px;
  font-weight: 700;
  margin: 16px 0 4px;
}

.loader-sub {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

.login-loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.65);
}

.login-loader[hidden] {
  display: none;
}

.login-loader-ring {
  position: relative;
  width: 148px;
  height: 148px;
}

.login-loader-ring img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 108px;
  height: auto;
  transform: translate(-50%, -50%);
}

.login-loader-ring svg {
  position: absolute;
  inset: 0;
  animation: spin 1s linear infinite;
}

.ring-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.25);
  stroke-width: 3;
}

.ring-arc {
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 107 320;
}

/* ---------- desktop: sidebar replaces top bar + bottom nav ---------- */

@media (min-width: 900px) {
  .topbar,
  .bottomnav {
    display: none;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 40;
    width: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    background: var(--sidebar);
    color: var(--sidebar-ink);
    padding: 22px 16px 18px;
  }

  .sidebar .brand {
    padding: 0 8px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .sidebar .brand img {
    width: 38px;
    height: 38px;
  }

  .sidebar .brand-name {
    color: #fff;
    font-size: 20px;
  }

  .side-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 18px;
    flex: 1;
  }

  .side-nav .nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    background: none;
    border: 0;
    border-radius: 12px;
    color: var(--sidebar-muted);
    font-size: 15px;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
  }

  .side-nav .nav-item svg {
    width: 20px;
    height: 20px;
    flex: none;
  }

  .side-nav .nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
  }

  .side-nav .nav-item.active {
    background: var(--blue);
    color: #fff;
  }

  .side-nav .nav-badge {
    position: static;
    margin-left: auto;
    border: 0;
  }

  .side-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 10px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .side-user .avatar {
    width: 40px;
    height: 40px;
  }

  .side-who {
    flex: 1;
    min-width: 0;
  }

  .side-who b {
    display: block;
    color: #fff;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .side-who span {
    color: var(--sidebar-muted);
    font-size: 12px;
  }

  .side-user .icon-btn {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 36px;
    height: 36px;
  }

  .app-shell .page {
    margin-left: var(--sidebar-w);
    padding: 28px 32px 48px;
  }

  .stat-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .dash-grid {
    grid-template-columns: 1.5fr 1fr;
  }

  .plan-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 640px) and (max-width: 899px) {
  .plan-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner,
  .login-loader-ring svg {
    animation: none;
  }

  * {
    transition: none !important;
  }
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
