:root {
  --bg: #f4f8fc;
  --bg-elevated: #ffffff;
  --sidebar-bg: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --primary: #0ea5e9;
  --primary-dark: #0284c7;
  --primary-soft: #e0f2fe;
  --success: #10b981;
  --danger: #ef4444;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(15, 23, 42, 0.06);
  --sidebar-w: 248px;
  --font: "DM Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.app-body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}
.brand {
  display: flex; align-items: center; gap: .75rem;
  text-decoration: none; color: var(--text); font-weight: 700; font-size: 1.1rem;
  margin-bottom: 1.5rem; padding: .25rem .5rem;
}
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  color: #fff; display: grid; place-items: center; font-weight: 800;
}
.sidebar-nav { display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem .85rem; border-radius: 10px;
  color: var(--text-muted); text-decoration: none; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--primary-soft); color: var(--primary-dark); }
.nav-item.is-active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.nav-item i { width: 18px; height: 18px; }
.nav-divider { height: 1px; background: var(--border); margin: .75rem 0; }
.sidebar-footer { font-size: .8rem; color: var(--text-muted); padding: .5rem; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.5rem; background: rgba(255,255,255,.85);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: .75rem; }
.sidebar-toggle { display: none; border: none; background: transparent; cursor: pointer; }

.content-area { padding: 1.5rem; max-width: 1200px; width: 100%; }
.site-announcement {
  background: var(--primary-soft); color: var(--primary-dark);
  border: 1px solid #bae6fd; border-radius: 10px;
  padding: .75rem 1rem; margin-bottom: 1rem; font-size: .95rem;
}

.hero { padding: 2rem 0 2.5rem; }
.hero-badge {
  display: inline-block; background: var(--primary-soft); color: var(--primary-dark);
  padding: .35rem .75rem; border-radius: 999px; font-size: .85rem; font-weight: 600; margin-bottom: 1rem;
}
.hero h1 { font-size: clamp(2rem, 4vw, 2.75rem); line-height: 1.15; margin: 0 0 1rem; }
.text-gradient { background: linear-gradient(90deg, #0ea5e9, #6366f1); -webkit-background-clip: text; color: transparent; }
.hero-lead { color: var(--text-muted); font-size: 1.1rem; max-width: 560px; margin-bottom: 1.5rem; }
.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.feature-card {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow);
}
.feature-card i { color: var(--primary); margin-bottom: .75rem; }
.feature-card h3 { margin: 0 0 .5rem; }
.feature-card p { margin: 0; color: var(--text-muted); font-size: .95rem; }

.page-header { margin-bottom: 1.5rem; }
.page-header h1 { margin: 0 0 .35rem; }
.page-header p { margin: 0; color: var(--text-muted); }

.plans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.plan-card {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .75rem;
}
.plan-card h3 { margin: 0; font-size: 1.1rem; }
.plan-price { font-size: 1.5rem; font-weight: 700; color: var(--primary-dark); }
.plan-meta { color: var(--text-muted); font-size: .9rem; flex: 1; }
.loading-state, .muted { color: var(--text-muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border: none; border-radius: 10px; padding: .65rem 1rem; font-weight: 600;
  cursor: pointer; text-decoration: none; font-family: inherit; font-size: .95rem;
  transition: transform .12s, box-shadow .12s, background .12s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(14,165,233,.35); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-soft { background: var(--primary-soft); color: var(--primary-dark); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-block { width: 100%; }

.user-chip {
  display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--text);
  padding: .35rem .5rem .35rem .35rem; border-radius: 999px; border: 1px solid var(--border); background: #fff;
}
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--primary-soft);
  color: var(--primary-dark); display: grid; place-items: center; font-weight: 700; font-size: .85rem;
}
.user-name { font-size: .9rem; font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.panel {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1rem;
}
.account-layout { display: grid; gap: 1rem; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin: 1rem 0; }
.stat-card { background: var(--bg); border-radius: 10px; padding: 1rem; }
.stat-label { display: block; color: var(--text-muted); font-size: .85rem; margin-bottom: .25rem; }
.account-actions { display: flex; gap: .75rem; flex-wrap: wrap; }

.login-panel { display: grid; place-items: center; min-height: 50vh; }
.login-card { max-width: 420px; width: 100%; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow); text-align: center; }
.login-card h1 { margin-top: 0; }

.tabs { display: flex; gap: .5rem; margin-bottom: 1rem; }
.tab { border: 1px solid var(--border); background: #fff; border-radius: 8px; padding: .45rem .85rem; cursor: pointer; }
.tab.is-active { background: var(--primary-soft); border-color: #bae6fd; color: var(--primary-dark); font-weight: 600; }
.services-list { display: flex; flex-direction: column; gap: .5rem; }
.service-row { display: flex; justify-content: space-between; padding: .75rem; background: var(--bg); border-radius: 8px; font-size: .95rem; }

.checkout-layout { display: grid; grid-template-columns: 1.2fr .8fr; gap: 1rem; }
.pay-methods { display: flex; flex-direction: column; gap: .5rem; margin: 1rem 0; }
.pay-option { display: flex; align-items: center; gap: .5rem; padding: .65rem; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }

.modal[hidden] { display: none !important; }
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 1rem; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.35); backdrop-filter: blur(2px); }
.modal-card {
  position: relative; background: #fff; border-radius: var(--radius); width: min(480px, 100%);
  box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden;
}
.modal-card-wide { width: min(560px, 100%); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.modal-header h2 { margin: 0; font-size: 1.1rem; }
.modal-body { padding: 1.25rem; }
.modal-footer { display: flex; justify-content: flex-end; gap: .5rem; padding: 1rem 1.25rem; border-top: 1px solid var(--border); }
.icon-btn { border: none; background: transparent; font-size: 1.5rem; cursor: pointer; color: var(--text-muted); }
.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.field input { padding: .65rem .75rem; border: 1px solid var(--border); border-radius: 8px; font: inherit; }
.hint { color: var(--text-muted); font-size: .9rem; }
.deposit-qr img { max-width: 100%; border-radius: 8px; }
.hidden { display: none !important; }
.alert { padding: .75rem; border-radius: 8px; background: var(--primary-soft); margin: 1rem 0; }
.alert-error { background: #fef2f2; color: #b91c1c; }

.toast {
  position: fixed; top: 1rem; right: 1rem; z-index: 200;
  background: #0f172a; color: #fff; padding: .75rem 1rem; border-radius: 10px;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }

@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); transition: transform .2s; z-index: 50; }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-toggle { display: inline-flex; }
  .checkout-layout { grid-template-columns: 1fr; }
}
