:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #fff7f2;
  --text: #18212f;
  --muted: #6b7280;
  --line: #e7e9ef;
  --primary: #ff5a1f;
  --primary-dark: #e64a12;
  --primary-soft: #fff0e9;
  --green: #0ca678;
  --yellow: #f59f00;
  --red: #e03131;
  --blue: #2563eb;
  --shadow: 0 12px 36px rgba(20, 28, 45, .08);
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar: 254px;
  --header: 70px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.app-shell { min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(255,255,255,.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 22px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center; color: white;
  background: linear-gradient(135deg, var(--primary), #ff8a45);
  box-shadow: 0 8px 18px rgba(255,90,31,.24);
}
.brand em { color: var(--primary); font-style: normal; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.header-user { display: flex; align-items: center; gap: 10px; padding: 7px 10px 7px 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--primary-soft); color: var(--primary); }
.avatar.lg { width: 58px; height: 58px; font-size: 20px; }
.icon-btn { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--text); }
.icon-btn:hover { border-color: #ffd0bd; background: var(--primary-soft); }

.layout { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: calc(100vh - var(--header)); }
.sidebar {
  position: sticky; top: var(--header); height: calc(100vh - var(--header));
  padding: 20px 16px; background: var(--surface); border-right: 1px solid var(--line); overflow: auto;
}
.nav-group { margin-bottom: 18px; }
.nav-label { padding: 0 12px 8px; color: #9aa1ad; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 10px 12px; margin: 3px 0; border-radius: 12px; color: #4b5563; font-weight: 650; cursor: pointer; }
.nav-link:hover { color: var(--text); background: #f7f7f9; }
.nav-link.active { color: var(--primary); background: var(--primary-soft); }
.nav-icon { width: 21px; height: 21px; flex: 0 0 auto; }
.nav-spacer { flex: 1; }
.nav-badge { min-width: 22px; padding: 2px 6px; border-radius: 999px; background: var(--primary); color: white; text-align: center; font-size: 11px; }

.main { width: 100%; min-width: 0; padding: 28px; }
.container { width: min(1180px, 100%); margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-title { margin: 0; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.03em; }
.page-subtitle { margin: 7px 0 0; color: var(--muted); }

.hero {
  position: relative; overflow: hidden; min-height: 325px; padding: 54px;
  display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: 32px;
  border-radius: 28px; color: white;
  background: radial-gradient(circle at 85% 15%, rgba(255,255,255,.25), transparent 28%), linear-gradient(135deg, #ff5a1f, #ff8542 60%, #ff9d63);
  box-shadow: 0 22px 60px rgba(255,90,31,.24);
}
.hero::after { content: ""; position: absolute; width: 340px; height: 340px; border: 55px solid rgba(255,255,255,.09); border-radius: 50%; right: -100px; bottom: -160px; }
.hero-content, .hero-card { position: relative; z-index: 1; }
.hero h1 { margin: 0 0 14px; font-size: clamp(34px, 5vw, 58px); line-height: 1.04; letter-spacing: -.045em; }
.hero p { max-width: 650px; margin: 0 0 24px; color: rgba(255,255,255,.9); font-size: 17px; line-height: 1.7; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-card { padding: 24px; border: 1px solid rgba(255,255,255,.25); border-radius: 22px; background: rgba(255,255,255,.16); backdrop-filter: blur(16px); }
.hero-metric { display: flex; align-items: center; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid rgba(255,255,255,.18); }
.hero-metric:last-child { border: 0; }
.hero-metric strong { font-size: 20px; }

.btn { min-height: 44px; padding: 10px 17px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 12px; cursor: pointer; font-weight: 750; transition: .18s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 8px 18px rgba(255,90,31,.22); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-light { background: white; color: var(--primary); }
.btn-outline-light { border-color: rgba(255,255,255,.45); color: white; background: rgba(255,255,255,.1); }
.btn-secondary { border-color: var(--line); background: var(--surface); color: var(--text); }
.btn-danger { background: #fff0f0; color: var(--red); border-color: #ffd0d0; }
.btn-sm { min-height: 36px; padding: 7px 12px; border-radius: 10px; font-size: 13px; }
.btn-block { width: 100%; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.section { margin-top: 26px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.section-title { margin: 0; font-size: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 5px 18px rgba(20,28,45,.035); }
.card-pad { padding: 22px; }
.stat-card { padding: 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 650; }
.stat-value { margin-top: 8px; font-size: 27px; font-weight: 850; letter-spacing: -.03em; }
.stat-note { margin-top: 6px; color: var(--green); font-size: 12px; font-weight: 700; }
.stat-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: var(--primary-soft); color: var(--primary); }

.feature-card { padding: 22px; }
.feature-icon { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; color: var(--primary); background: var(--primary-soft); margin-bottom: 16px; }
.feature-card h3 { margin: 0 0 8px; }
.feature-card p { margin: 0; color: var(--muted); line-height: 1.65; }

.form-grid { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; }
.field label { font-size: 13px; font-weight: 750; }
.input, .select, .textarea { width: 100%; min-height: 46px; padding: 10px 13px; border: 1px solid #dfe2e8; border-radius: 12px; outline: none; background: white; color: var(--text); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.textarea { min-height: 110px; resize: vertical; }
.input-row { display: flex; gap: 10px; }
.input-row .input { flex: 1; }
.form-help { color: var(--muted); font-size: 12px; line-height: 1.5; }

.cashback-box { padding: 24px; background: linear-gradient(140deg, #fff, #fff7f2); }
.platform-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.platform-tab { border: 1px solid var(--line); background: white; padding: 9px 14px; border-radius: 999px; cursor: pointer; font-weight: 750; color: var(--muted); }
.platform-tab.active { background: var(--primary); border-color: var(--primary); color: white; }
.result-box { display: none; margin-top: 18px; padding: 18px; border-radius: 15px; background: #f7faf9; border: 1px solid #d9eee6; }
.result-box.show { display: block; }
.result-product { display: flex; gap: 14px; align-items: center; }
.product-thumb { width: 64px; height: 64px; border-radius: 14px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 900; }
.result-values { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-top: 16px; }
.result-value { padding: 12px; border-radius: 12px; background: white; border: 1px solid var(--line); }
.result-value span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13px; }
th { color: #838b98; background: #fafbfc; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
tr:last-child td { border-bottom: 0; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.pending { color: #a26300; background: #fff6d8; }
.status.success { color: #087f5b; background: #dcf8ed; }
.status.cancel { color: #c92a2a; background: #ffe3e3; }
.status.info { color: #1d4ed8; background: #e7efff; }

.wallet-card { padding: 25px; color: white; background: linear-gradient(135deg, #20293a, #374151); border-radius: 22px; box-shadow: var(--shadow); }
.wallet-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.wallet-balance { margin-top: 9px; font-size: 36px; font-weight: 900; letter-spacing: -.04em; }
.wallet-chip { width: 48px; height: 36px; border-radius: 9px; background: linear-gradient(135deg,#f7d774,#c79c28); }
.wallet-meta { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-top: 28px; }
.wallet-meta div { padding-top: 12px; border-top: 1px solid rgba(255,255,255,.16); }
.wallet-meta span { display: block; color: rgba(255,255,255,.65); font-size: 11px; }
.wallet-meta strong { display: block; margin-top: 5px; }

.progress { height: 10px; border-radius: 999px; background: #edf0f4; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.task { display: flex; gap: 14px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border: 0; }
.task-icon { width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 13px; background: var(--primary-soft); color: var(--primary); }
.task-main { min-width: 0; flex: 1; }
.task-title { font-weight: 800; }
.task-desc { margin-top: 3px; color: var(--muted); font-size: 12px; }

.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.auth-cover { padding: 54px; display: flex; flex-direction: column; justify-content: space-between; color: white; background: radial-gradient(circle at 75% 22%, rgba(255,255,255,.25), transparent 25%), linear-gradient(145deg,#ff5a1f,#ff8b4d); }
.auth-cover h1 { font-size: clamp(38px, 5vw, 64px); margin: 0; line-height: 1.06; letter-spacing: -.05em; }
.auth-cover p { max-width: 560px; line-height: 1.7; color: rgba(255,255,255,.88); }
.auth-points { display: grid; gap: 12px; }
.auth-point { display: flex; gap: 10px; align-items: center; }
.auth-panel { display: grid; place-items: center; padding: 30px; background: white; }
.auth-box { width: min(430px, 100%); }
.auth-box h2 { margin: 0 0 8px; font-size: 30px; }
.auth-box > p { margin: 0 0 25px; color: var(--muted); }
.demo-box { margin-top: 18px; padding: 14px; border: 1px dashed #ffc3aa; border-radius: 12px; background: var(--primary-soft); color: #87401f; font-size: 12px; line-height: 1.7; }

.profile-head { display: flex; align-items: center; gap: 16px; }
.profile-info h3 { margin: 0; }
.profile-info p { margin: 5px 0 0; color: var(--muted); }
.detail-list { display: grid; }
.detail-item { display: flex; justify-content: space-between; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.detail-item:last-child { border: 0; }
.detail-item span { color: var(--muted); }

.admin-strip { margin-bottom: 20px; padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid #dce6ff; border-radius: 14px; background: #f2f6ff; color: #254f9c; }
.admin-kpi { padding: 19px; }
.admin-kpi .trend { margin-top: 8px; font-size: 12px; color: var(--green); }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 18px; background: rgba(10,16,26,.58); backdrop-filter: blur(4px); }
.modal { width: min(520px,100%); max-height: 90vh; overflow: auto; padding: 24px; background: white; border-radius: 20px; box-shadow: 0 25px 80px rgba(0,0,0,.22); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.modal-head h3 { margin: 0; }

.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty-icon { width: 64px; height: 64px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 18px; background: #f1f3f5; color: #9aa1ad; }

.toast-root { position: fixed; z-index: 200; right: 18px; bottom: 18px; display: grid; gap: 10px; }
.toast { min-width: 260px; max-width: 390px; padding: 13px 15px; display: flex; gap: 10px; align-items: flex-start; border-radius: 13px; background: #1f2937; color: white; box-shadow: var(--shadow); animation: toastIn .2s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

.mobile-nav { display: none; }
.mobile-menu-btn { display: none; }
.hide { display: none !important; }
.text-primary { color: var(--primary); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.muted { color: var(--muted); }
.fw-800 { font-weight: 800; }
.mt-0 { margin-top: 0; }
.mt-16 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }

@media (max-width: 1024px) {
  :root { --sidebar: 220px; }
  .grid-4 { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .hero { padding: 40px; }
}

@media (max-width: 780px) {
  body { padding-bottom: 72px; }
  .topbar { height: 62px; padding: 0 16px; }
  .brand { font-size: 19px; }
  .brand-mark { width: 34px; height: 34px; }
  .header-user span, .desktop-only { display: none; }
  .layout { display: block; min-height: calc(100vh - 62px); }
  .sidebar { display: none; }
  .main { padding: 18px 14px 26px; }
  .hero { min-height: auto; padding: 28px 22px; grid-template-columns: 1fr; border-radius: 22px; }
  .hero h1 { font-size: 37px; }
  .hero-card { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-4.mobile-2 { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .stat-card { padding: 16px; }
  .stat-value { font-size: 22px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .result-values { grid-template-columns: 1fr; }
  .wallet-meta { grid-template-columns: 1fr; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-cover { display: none; }
  .auth-panel { min-height: 100vh; padding: 22px; }
  .mobile-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
    display: grid; grid-template-columns: repeat(5,1fr);
    padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(16px);
  }
  .mobile-nav a { display: grid; place-items: center; gap: 3px; min-height: 48px; color: #7b8492; font-size: 10px; font-weight: 750; }
  .mobile-nav a.active { color: var(--primary); }
  .mobile-nav .nav-icon { width: 20px; height: 20px; }
  .mobile-menu-btn { display: grid; }
  .table-wrap { margin: 0 -14px; }
  table { min-width: 680px; }
  th,td { padding: 12px; }
}

@media (max-width: 430px) {
  .grid-4.mobile-2 { gap: 10px; }
  .grid-4.mobile-2 .stat-card { padding: 14px; }
  .grid-4.mobile-2 .stat-icon { width: 39px; height: 39px; }
  .input-row { flex-direction: column; }
  .hero-actions .btn { width: 100%; }
  .toast-root { left: 12px; right: 12px; bottom: 86px; }
  .toast { min-width: 0; max-width: none; }
}
