/* =====================================================================
   Ugcheap Activate Portal — Design System
   Font: Space Grotesk (heading/số liệu) + Plus Jakarta Sans (body/UI)
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg:#eef2fb; --surface:#ffffff; --surface-2:#f3f6fd; --border:#dce3f5;
  --text:#10142a; --text-muted:#5b6482;
  --gold:#b8842a; --gold-soft:#fbf0dc;
  --violet:#5457e5; --violet-soft:#eaeafc;
  --teal:#0e9f82; --teal-soft:#dff7f0;
  --rose:#d1487d; --rose-soft:#fbe7f0;
  --red:#d23c4a; --red-soft:#fbe4e6;
  --sidebar-grad: linear-gradient(180deg,#171c3a,#10132a);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-soft: 0 10px 30px -12px rgba(16,20,42,.12);
  --font-head: 'Space Grotesk', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
}

:root[data-theme="dark"] {
  --bg:#0b0e1c; --surface:#141a30; --surface-2:#101527; --border:#232b4a;
  --text:#eaf0ff; --text-muted:#8c96bc;
  --gold:#e8b86d; --gold-soft:#2a2113;
  --violet:#8b92ff; --violet-soft:#1e2150;
  --teal:#3dd9a4; --teal-soft:#0f2a24;
  --rose:#ef6f9e; --rose-soft:#321826;
  --red:#f2707a; --red-soft:#3a1620;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:#0b0e1c; --surface:#141a30; --surface-2:#101527; --border:#232b4a;
    --text:#eaf0ff; --text-muted:#8c96bc;
    --gold:#e8b86d; --gold-soft:#2a2113;
    --violet:#8b92ff; --violet-soft:#1e2150;
    --teal:#3dd9a4; --teal-soft:#0f2a24;
    --rose:#ef6f9e; --rose-soft:#321826;
    --red:#f2707a; --red-soft:#3a1620;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4,.num,.font-head { font-family: var(--font-head); letter-spacing: -0.01em; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

/* ---------- Sidebar (always dark console rail) ---------- */
.sidebar {
  width: 264px;
  flex-shrink: 0;
  background: var(--sidebar-grad);
  color: #eaf0ff;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; }
.sidebar-brand .logo-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg,#f0c27a,#c8912f);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 700; color: #171c3a;
}
.sidebar-brand .brand-text { font-family: var(--font-head); font-weight: 700; font-size: 16px; color: #fff; }
.sidebar-brand .brand-sub { font-size: 11px; color: #8c96bc; }

.nav-group { margin-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 12px;
  color: #c3c9e8; font-size: 14px; font-weight: 500;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; transform: translateX(2px); }
.nav-item.active { background: rgba(255,255,255,.1); color: #fff; }
.navdot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 3px rgba(255,255,255,.06); }
.nav-divider { height: 1px; background: rgba(255,255,255,.08); margin: 14px 4px; }
.nav-label-muted { font-size: 11px; color: #5e6690; padding: 6px 12px 2px; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- Main content ---------- */
.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-family: var(--font-head); font-weight: 600; font-size: 19px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; color: var(--text);
  transition: background .15s;
}
.icon-btn:hover { background: var(--border); }

.content { padding: 28px; max-width: 1240px; margin: 0 auto; }

/* ---------- Marquee ---------- */
.marquee-wrap { background: var(--violet-soft); border-bottom: 1px solid var(--border); overflow: hidden; white-space: nowrap; padding: 8px 0; }
.marquee-track { display: inline-block; padding-left: 100%; animation: marquee 22s linear infinite; color: var(--violet); font-weight: 600; font-size: 13px; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-100%); } }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-soft);
}
.card-title { font-family: var(--font-head); font-weight: 600; font-size: 16px; margin: 0 0 14px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; position: relative; overflow: hidden; }
.stat-tile .stat-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.stat-tile .stat-num { font-family: var(--font-head); font-size: 26px; font-weight: 700; }
.stat-tile .stat-label { font-size: 13px; color: var(--text-muted); }
.stat-violet .stat-icon { background: var(--violet-soft); color: var(--violet); }
.stat-gold .stat-icon { background: var(--gold-soft); color: var(--gold); }
.stat-teal .stat-icon { background: var(--teal-soft); color: var(--teal); }
.stat-rose .stat-icon { background: var(--rose-soft); color: var(--rose); }

/* Wallet hero */
.hero-wallet {
  border-radius: var(--radius); padding: 24px; margin-bottom: 24px; color: #fff;
  background: radial-gradient(120% 160% at 10% 0%, #2b2f66 0%, #171a35 55%, #0d0f20 100%);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px;
  position: relative; overflow: hidden;
}
.hero-wallet::after {
  content: ''; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(240,194,122,.25), transparent 70%); border-radius: 50%;
}
.hero-wallet .hw-greet { font-size: 13px; color: #a7aede; }
.hero-wallet .hw-name { font-family: var(--font-head); font-size: 20px; font-weight: 700; }
.hero-wallet .hw-balance-label { font-size: 12px; color: #a7aede; }
.hero-wallet .hw-balance { font-family: var(--font-head); font-size: 28px; font-weight: 700; color: #f0c27a; }

/* ---------- Device / signal-bar time-remaining widget ---------- */
.devcard-list { display: flex; flex-direction: column; gap: 12px; }
.devcard {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.devcard .dev-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--violet-soft); color: var(--violet); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.devcard .dev-info { flex: 1; min-width: 0; }
.devcard .dev-name { font-weight: 600; font-size: 14px; }
.devcard .dev-sub { font-size: 12px; color: var(--text-muted); }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 22px; }
.bars span { width: 5px; border-radius: 2px; background: var(--border); }
.bars span:nth-child(1) { height: 30%; } .bars span:nth-child(2) { height: 50%; }
.bars span:nth-child(3) { height: 70%; } .bars span:nth-child(4) { height: 90%; } .bars span:nth-child(5) { height: 100%; }
.bars.ok span.lit { background: var(--teal); }
.bars.warn span.lit { background: var(--gold); }
.bars.urgent span.lit { background: var(--red); }
.dev-time-label { font-size: 12px; font-weight: 600; margin-top: 2px; }
.disclaimer-note { font-size: 11px; color: var(--text-muted); margin-top: 10px; font-style: italic; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px; font-weight: 600; font-size: 14px;
  border: none; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; font-family: var(--font-body);
}
.btn:active { transform: scale(.97); }
.btn-gold { background: linear-gradient(135deg,#f0c27a,#c8912f); color: #241a05; box-shadow: 0 8px 20px -8px rgba(200,145,47,.6); }
.btn-teal { background: linear-gradient(135deg,#4fe0bb,#0e9f82); color: #04231b; box-shadow: 0 8px 20px -8px rgba(14,159,130,.5); }
.btn-violet { background: linear-gradient(135deg,#8b92ff,#5457e5); color: #fff; box-shadow: 0 8px 20px -8px rgba(84,87,229,.5); }
.btn-rose { background: linear-gradient(135deg,#f090b3,#d1487d); color: #2b0414; box-shadow: 0 8px 20px -8px rgba(209,72,125,.5); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--surface-2); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-family: var(--font-body); font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-soft);
}
.field .hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ---------- Badges / chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.chip-pending { background: var(--gold-soft); color: var(--gold); }
.chip-approved { background: var(--teal-soft); color: var(--teal); }
.chip-rejected { background: var(--red-soft); color: var(--red); }
.chip-share { background: var(--gold-soft); color: var(--gold); }
.chip-renew { background: var(--teal-soft); color: var(--teal); }
.chip-swap { background: var(--rose-soft); color: var(--rose); }

/* ---------- Tables / list rows ---------- */
.order-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px;
  background: var(--surface); animation: rise .35s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.order-row .order-main { display: flex; flex-direction: column; gap: 3px; }
.order-row .order-id { font-weight: 700; font-size: 13.5px; }
.order-row .order-sub { font-size: 12px; color: var(--text-muted); }

.tabs { display: flex; gap: 6px; margin-bottom: 18px; background: var(--surface-2); padding: 4px; border-radius: 999px; width: fit-content; }
.tab-btn { padding: 8px 18px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; border: none; background: transparent; }
.tab-btn.active { background: var(--surface); color: var(--text); box-shadow: 0 2px 6px rgba(16,20,42,.08); }

/* ---------- Login page ---------- */
.login-shell { display: flex; min-height: 100vh; }
.login-panel-dark {
  flex: 1.1; background: radial-gradient(120% 140% at 15% 10%, #232a57 0%, #141833 46%, #0c0f20 100%);
  display: flex; flex-direction: column; justify-content: center; padding: 60px; color: #fff; position: relative; overflow: hidden;
}
.login-panel-dark .orbit-field { position: absolute; inset: 0; }
.orbit-ring { position: absolute; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; }
.orbit-ring.r1 { width: 420px; height: 420px; top: 10%; left: 10%; animation: orbit 60s linear infinite; }
.orbit-ring.r2 { width: 620px; height: 620px; top: -5%; left: -5%; animation: orbit-rev 90s linear infinite; }
@keyframes orbit { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes orbit-rev { from { transform: rotate(0deg); } to { transform: rotate(-360deg); } }
.orbit-dot { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: #e8b86d; box-shadow: 0 0 12px #e8b86d; animation: drift 7s ease-in-out infinite; }
@keyframes drift { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
.login-logo-mark { display: flex; align-items: center; gap: 10px; margin-bottom: 36px; position: relative; z-index: 2; }
.login-panel-dark h1 { font-size: 30px; margin: 0 0 12px; position: relative; z-index: 2; }
.login-panel-dark p { color: #a7aede; max-width: 360px; position: relative; z-index: 2; }

.login-panel-form { flex: 1; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 40px; }
.login-form-box { width: 100%; max-width: 380px; }
.login-form-box h2 { font-family: var(--font-head); font-size: 24px; margin-bottom: 6px; }
.login-form-box .sub { color: var(--text-muted); font-size: 14px; margin-bottom: 28px; }
.login-footer-link { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-muted); }
.login-footer-link a { color: var(--violet); font-weight: 600; }
.form-row-between { display: flex; align-items: center; justify-content: space-between; font-size: 13px; margin-bottom: 20px; }

@media (max-width: 860px) {
  .login-panel-dark { display: none; }
  .sidebar { position: fixed; left: -280px; z-index: 50; transition: left .2s ease; }
  .sidebar.open { left: 0; }
  .stat-grid { grid-template-columns: 1fr; }
}

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 16px; }
.alert-error { background: var(--red-soft); color: var(--red); border: 1px solid var(--red); }
.alert-success { background: var(--teal-soft); color: var(--teal); border: 1px solid var(--teal); }
.alert-info { background: var(--violet-soft); color: var(--violet); border: 1px solid var(--violet); }

/* ---------- FAQ accordion ---------- */
.faq-item { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; overflow: hidden; background: var(--surface); }
.faq-q { display: flex; align-items: center; gap: 14px; padding: 16px; cursor: pointer; }
.faq-num { font-family: var(--font-head); color: var(--violet); font-weight: 700; font-size: 13px; }
.faq-q-text { flex: 1; font-weight: 600; font-size: 14.5px; }
.faq-chev { transition: transform .2s ease; color: var(--text-muted); }
.faq-item.open .faq-chev { transform: rotate(180deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height .25s ease; font-size: 13.5px; color: var(--text-muted); padding: 0 16px; }
.faq-item.open .faq-a { max-height: 400px; padding: 0 16px 16px 46px; }

/* ---------- Support chat bubbles ---------- */
.chat-thread { display: flex; flex-direction: column; gap: 12px; }
.bubble { max-width: 70%; padding: 12px 16px; border-radius: 16px; font-size: 13.5px; animation: rise .3s ease both; }
.bubble-user { align-self: flex-end; background: linear-gradient(135deg,#8b92ff,#5457e5); color: #fff; border-bottom-right-radius: 4px; }
.bubble-admin { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }

/* ---------- Timeline (Lịch sử thông báo) ---------- */
.tl { position: relative; padding-left: 24px; }
.tl::before { content: ''; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.trow { position: relative; padding-bottom: 20px; }
.trow .dot { position: absolute; left: -24px; top: 3px; width: 13px; height: 13px; border-radius: 50%; border: 3px solid var(--surface); }

/* ---------- Avatar menu ---------- */
.avatar-circle { width: 36px; height: 36px; border-radius: 50%; background: var(--violet-soft); color: var(--violet); display: flex; align-items: center; justify-content: center; font-weight: 700; cursor: pointer; }
.dropdown-menu { position: absolute; right: 28px; top: 62px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-soft); min-width: 200px; overflow: hidden; z-index: 40; animation: rise .15s ease both; }
.dropdown-menu a, .dropdown-menu .dd-item { display: block; padding: 11px 16px; font-size: 13.5px; }
.dropdown-menu a:hover, .dropdown-menu .dd-item:hover { background: var(--surface-2); }
.dropdown-user-id { font-size: 11px; color: var(--text-muted); padding: 10px 16px 4px; }

/* ---------- Popup modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10,12,24,.55); display: flex; align-items: center; justify-content: center; z-index: 100; animation: rise .2s ease both; }
.modal-box { background: var(--surface); border-radius: var(--radius); padding: 26px; max-width: 420px; width: 90%; box-shadow: 0 20px 60px -20px rgba(0,0,0,.4); }

/* ---------- Admin ---------- */
.admin-shell .sidebar { background: linear-gradient(180deg,#0f172a,#060b16); }
.admin-badge { display: inline-block; background: var(--red-soft); color: var(--red); font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 6px; letter-spacing: .04em; margin-left: 8px; }

.scroll-x { overflow-x: auto; }
.text-muted { color: var(--text-muted); }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
