@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Plus+Jakarta+Sans:wght@600;700;800&family=Instrument+Serif:ital@1&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --brand: #5ed29c;
  --brand-dim: #4bb487;
  --ink: #070b0a;
  --panel: #0d1412;
  --panel-2: #0f1815;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --txt: #e9efec;
  --txt-dim: rgba(233, 239, 236, 0.62);
  --txt-faint: rgba(233, 239, 236, 0.40);
  --yellow: #e3c35a;
  --orange: #e08a4b;
  --red: #e0604b;
  --blue: #5b9ee0;
  --sb-w: 264px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--ink);
  color: var(--txt);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv05", "ss01";
}
#root { min-height: 100vh; }

.font-jakarta { font-family: 'Plus Jakarta Sans', sans-serif; }
.font-serif-it { font-family: 'Instrument Serif', serif; font-style: italic; }
.font-mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; color: inherit; cursor: pointer; }
button:active { transform: scale(0.97); }
.btn:active { transform: scale(0.97); }
.btn-green:hover { box-shadow: 0 0 22px rgba(94,210,156,0.28); }
::selection { background: rgba(94, 210, 156, 0.3); }
input, textarea, select { font-family: inherit; }

/* scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(94,210,156,0.2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(94,210,156,0.5); }

/* ============ App shell ============ */
.app { display: flex; min-height: 100vh; }
.app-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background-image:
    radial-gradient(rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 26px 26px;
  background-position: var(--bgx, 0px) var(--bgy, 0px);
  transition: background-position .4s cubic-bezier(.2,.8,.2,1);
}
.app-bg::before, .app-bg::after {
  content: ""; position: absolute; border-radius: 50%; will-change: transform; filter: blur(8px);
}
.app-bg::before {
  width: 600px; height: 600px; top: -180px; right: -120px;
  background: radial-gradient(circle, rgba(94,210,156,0.07), transparent 62%);
  animation: breathe 8s ease-in-out infinite;
}
.app-bg::after {
  width: 800px; height: 800px; bottom: -300px; left: -240px;
  background: radial-gradient(circle, rgba(10,61,46,0.55), transparent 60%);
  animation: breathe 8s ease-in-out infinite; animation-delay: -4s;
}
@keyframes breathe { 0%,100%{ transform: scale(1); } 50%{ transform: scale(1.15); } }

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky; top: 0; z-index: 20;
  width: var(--sb-w); flex: 0 0 var(--sb-w);
  height: 100vh; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #0a100e, #080c0b);
  border-right: 1px solid var(--line);
  padding: 22px 16px 16px;
}
.sb-logo { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; }
.sb-nav { display: flex; flex-direction: column; gap: 3px; }
.sb-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 11px;
  font-size: 13.5px; font-weight: 500; color: var(--txt-dim);
  transition: background .18s, color .18s, transform .18s; position: relative;
}
.sb-link:hover { background: rgba(255,255,255,0.04); color: var(--txt); transform: translateX(4px); }
.sb-link:hover svg { filter: drop-shadow(0 0 6px rgba(94,210,156,0.5)); color: var(--brand); }
.sb-link svg { transition: filter .18s, color .18s; }
.sb-link.active { background: rgba(94,210,156,0.12); color: var(--brand); }
.sb-link.active::before {
  content:""; position:absolute; left:-16px; top:50%; transform:translateY(-50%) scaleY(1);
  width:3px; height:18px; border-radius:0 3px 3px 0; background: var(--brand);
  box-shadow: 0 0 8px rgba(94,210,156,0.6);
  animation: borderPop .24s cubic-bezier(.34,1.56,.64,1);
}
@keyframes borderPop { from { transform: translateY(-50%) scaleY(0); } to { transform: translateY(-50%) scaleY(1); } }
.sb-link svg { flex: 0 0 18px; }
.sb-divider { height: 1px; background: var(--line); margin: 12px 8px; }
.sb-user {
  margin-top: auto; display: flex; align-items: center; gap: 11px;
  padding: 11px; border-radius: 14px; border: 1px solid var(--line);
  background: rgba(255,255,255,0.02); transition: border-color .16s;
}
.sb-user:hover { border-color: var(--line-strong); }

/* ---------- Topbar / content ---------- */
.main { flex: 1; min-width: 0; position: relative; z-index: 1; }
.topbar {
  position: sticky; top: 0; z-index: 15;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 16px 32px;
  background: rgba(7,11,10,0.72); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.content { padding: 28px 32px 64px; max-width: 1320px; }

/* ---------- Cards ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 22px;
}
.card-tight { padding: 18px; }
.hairline { border-bottom: 1px solid var(--line); }

.avatar {
  display: grid; place-items: center; border-radius: 999px;
  background: linear-gradient(140deg, #2f6f57, #16312a);
  color: #d9fff0; font-weight: 700; letter-spacing: .02em;
  border: 1px solid rgba(94,210,156,0.4);
}

/* ---------- Buttons ---------- */
.btn { display:inline-flex; align-items:center; justify-content:center; gap:8px;
  border-radius: 999px; font-weight: 700; font-size: 13px; letter-spacing: .01em;
  padding: 10px 18px; border: 1px solid transparent; transition: all .16s; white-space: nowrap; }
.btn-green { background: var(--brand); color: var(--ink); }
.btn-green:hover { filter: brightness(1.08); }
.btn-ghost { border-color: var(--line-strong); color: var(--txt); background: transparent; }
.btn-ghost:hover { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.28); }
.btn-green-ghost { border-color: rgba(94,210,156,0.4); color: var(--brand); background: rgba(94,210,156,0.06); }
.btn-green-ghost:hover { background: rgba(94,210,156,0.13); }
.btn-red-ghost { border-color: rgba(224,96,75,0.4); color: var(--red); background: transparent; }
.btn-red-ghost:hover { background: rgba(224,96,75,0.12); }
.btn-sm { padding: 7px 13px; font-size: 12px; }
.btn-lg { padding: 14px 24px; font-size: 14px; }

/* ---------- Pills / tags ---------- */
.pill { display:inline-flex; align-items:center; gap:6px; border-radius:999px;
  padding: 5px 12px; font-size: 12px; font-weight: 600; border: 1px solid var(--line); }
.pill-green { color: var(--brand); border-color: rgba(94,210,156,0.35); background: rgba(94,210,156,0.10); }
.pill-blue  { color: var(--blue); border-color: rgba(91,158,224,0.35); background: rgba(91,158,224,0.10); }
.tag-chip { font-size: 11px; padding: 3px 9px; border-radius: 7px;
  background: rgba(94,210,156,0.10); color: var(--brand); font-weight: 600; }

/* ---------- Status dot ---------- */
.dot { width: 7px; height: 7px; border-radius: 999px; display:inline-block; position: relative; }
.dot-green { background: var(--brand); box-shadow: 0 0 0 3px rgba(94,210,156,0.18); }
.dot-green::after { content:""; position:absolute; inset:0; border-radius:inherit; box-shadow: 0 0 0 1.5px var(--brand); animation: ring 2s ease-out infinite; }
.dot-yellow{ background: var(--yellow); box-shadow: 0 0 0 3px rgba(227,195,90,0.18); animation: pulse 1.4s infinite; }
.dot-orange{ background: var(--orange); box-shadow: 0 0 0 3px rgba(224,138,75,0.18); animation: pulse 2s infinite; }
.dot-red   { background: var(--red); box-shadow: 0 0 0 3px rgba(224,96,75,0.18); }
.dot-grey  { background: #6b7672; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }
@keyframes ring { 0%{transform:scale(1);opacity:.7} 100%{transform:scale(2.6);opacity:0} }

/* ---------- Inputs ---------- */
.input, .textarea, .select {
  width: 100%; background: rgba(255,255,255,0.03); border: 1px solid var(--line);
  border-radius: 11px; padding: 11px 14px; color: var(--txt); font-size: 14px;
  transition: border-color .16s, background .16s; outline: none;
}
.input:focus, .textarea:focus, .select:focus { border-color: rgba(94,210,156,0.5); background: rgba(255,255,255,0.05); }
.input::placeholder, .textarea::placeholder { color: var(--txt-faint); }
.label { font-size: 12px; font-weight: 600; color: var(--txt-dim); margin-bottom: 7px; display:block; }

/* ---------- Table ---------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; color: var(--txt-faint); padding: 0 14px 12px; }
.tbl td { padding: 14px; font-size: 13.5px; border-top: 1px solid var(--line); }
.tbl tr:hover td { background: rgba(255,255,255,0.02); }

/* ---------- Liquid glass ---------- */
.liquid-glass {
  position: relative; background: rgba(255,255,255,0.012);
  background-blend-mode: luminosity; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.10), 0 30px 60px -24px rgba(0,0,0,0.6);
  border-radius: 18px; overflow: hidden;
}
.liquid-glass::before {
  content:""; position:absolute; inset:0; padding:1.4px; border-radius:inherit;
  background: linear-gradient(180deg, rgba(255,255,255,0.6), rgba(255,255,255,0.04));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none;
}

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; right: 22px; bottom: 72px; z-index: 200; display:flex; flex-direction:column; gap:10px; }
.toast { display:flex; align-items:center; gap:11px; padding: 13px 16px; border-radius: 13px;
  background: #10201a; border: 1px solid var(--line-strong); min-width: 280px; max-width: 380px;
  box-shadow: 0 18px 40px -16px rgba(0,0,0,.7); animation: toastIn .26s cubic-bezier(.2,.8,.2,1); }
@keyframes toastIn { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform:none; } }
.toast.ok { border-color: rgba(94,210,156,0.4); }
.toast.err { border-color: rgba(224,96,75,0.4); }
.toast.warn { border-color: rgba(227,195,90,0.4); }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset:0; z-index: 150; display:grid; place-items:center; padding:24px;
  background: rgba(4,7,6,0.72); backdrop-filter: blur(8px); animation: fade .2s; }
.modal { width: 100%; animation: modalIn .26s cubic-bezier(.2,.8,.2,1); }
@keyframes fade { from{opacity:0} to{opacity:1} }
@keyframes modalIn { from{opacity:0; transform: translateY(14px) scale(.98)} to{opacity:1; transform:none} }

/* ---------- Misc ---------- */
.fade-up { animation: fadeUp .5s both; }
@keyframes fadeUp { from{ transform: translateY(12px)} to{transform:none} }
.creating-border { position: relative; }
.creating-border::after {
  content:""; position:absolute; inset:-1px; border-radius:inherit; padding:1px; pointer-events:none;
  background: linear-gradient(120deg, transparent, var(--yellow), transparent) ;
  background-size: 200% 100%; animation: sweep 2.2s linear infinite;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
@keyframes sweep { from{background-position: 200% 0} to{background-position: -200% 0} }

.grid-bg {
  background-image: linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 36px 36px;
}
.text-dim { color: var(--txt-dim); }
.text-faint { color: var(--txt-faint); }
.text-green { color: var(--brand); }
.text-red { color: var(--red); }
.text-yellow { color: var(--yellow); }
.blur-secret { filter: blur(5px); transition: filter .15s; cursor: pointer; user-select: none; }
.blur-secret.shown { filter: none; }

@media (max-width: 1080px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .25s; box-shadow: 0 0 60px rgba(0,0,0,.6); }
  .sidebar.open { transform: none; }
  .content { padding: 22px 18px 56px; }
  .topbar { padding: 14px 18px; }
}
@media (max-width: 1000px) {
  .stat-grid { grid-template-columns: 1fr 1fr !important; }
  .ref-grid, .manage-grid, .detail-grid, .profile-grid { grid-template-columns: 1fr !important; }
  .ctrl-grid { grid-template-columns: 1fr !important; }
}
@media (max-width: 720px) {
  .stat-grid, .svc-grid { grid-template-columns: 1fr !important; }
}

/* ===================================================================
   VISUAL ENHANCEMENT & ANIMATION PASS
   =================================================================== */
:root { --dur: .5s; --ease-spring: cubic-bezier(.34,1.56,.64,1); --ease-out: cubic-bezier(.2,.8,.2,1); }

/* page title slide-in */
.topbar h1 { animation: titleIn .42s var(--ease-out) backwards; }
@keyframes titleIn { from { transform: translateX(-20px); } to { transform:none; } }

/* staggered card reveal (backwards fill so :hover transforms still win) */
.content .card:not(.modal) { animation: cardReveal var(--dur) var(--ease-out) backwards; }
.content .card:nth-child(1){ animation-delay:.04s } .content .card:nth-child(2){ animation-delay:.10s }
.content .card:nth-child(3){ animation-delay:.16s } .content .card:nth-child(4){ animation-delay:.22s }
.content .card:nth-child(5){ animation-delay:.28s } .content .card:nth-child(6){ animation-delay:.34s }
.content .card:nth-child(7){ animation-delay:.40s } .content .card:nth-child(8){ animation-delay:.46s }
.stat-grid .card:nth-child(1){ animation-delay:.06s } .stat-grid .card:nth-child(2){ animation-delay:.14s }
.stat-grid .card:nth-child(3){ animation-delay:.22s } .stat-grid .card:nth-child(4){ animation-delay:.30s }
@keyframes cardReveal { from { transform: translateY(16px); } to { transform:none; } }

/* table rows stagger-in */
.tbl tbody tr { animation: rowIn .42s var(--ease-out) backwards; }
.tbl tbody tr:nth-child(1){animation-delay:.05s}.tbl tbody tr:nth-child(2){animation-delay:.09s}
.tbl tbody tr:nth-child(3){animation-delay:.13s}.tbl tbody tr:nth-child(4){animation-delay:.17s}
.tbl tbody tr:nth-child(5){animation-delay:.21s}.tbl tbody tr:nth-child(6){animation-delay:.25s}
.tbl tbody tr:nth-child(7){animation-delay:.29s}.tbl tbody tr:nth-child(8){animation-delay:.33s}
@keyframes rowIn { from { transform: translateY(8px); } to { transform:none; } }
.tbl tbody tr td { transition: background .15s; }

/* stat-card hover: lift, icon spin, bottom accent line */
.stat-card { position: relative; transition: transform .25s var(--ease-spring), box-shadow .25s, border-color .25s; overflow: hidden; }
.stat-card::after { content:""; position:absolute; left:0; bottom:0; height:2px; width:0; background: linear-gradient(90deg, var(--brand), transparent); transition: width .3s var(--ease-out); }
.stat-card:hover { transform: translateY(-4px); box-shadow: 0 20px 40px rgba(0,0,0,0.4); border-color: rgba(94,210,156,0.22); }
.stat-card:hover::after { width: 100%; }
.stat-card .stat-ic { transition: transform .25s var(--ease-spring); }
.stat-card:hover .stat-ic { transform: rotate(10deg) scale(1.1); }

/* count-up number */
.countup { font-variant-numeric: tabular-nums; }

/* bar chart entrance */
.bar-in { transform-box: fill-box; transform-origin: bottom; animation: barUp .6s var(--ease-spring) backwards; }
@keyframes barUp { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* QR float + level progress glow */
.qr-float { animation: floaty 3s ease-in-out infinite; }
@keyframes floaty { 0%,100%{ transform: translateY(0); } 50%{ transform: translateY(-4px); } }
.progress-fill { box-shadow: 8px 0 8px -4px rgba(94,210,156,0.7); transition: width 1.4s var(--ease-out); }

/* balance glow on mount */
.balance-glow { animation: balGlow 2.2s ease-out; }
@keyframes balGlow { 0%{ text-shadow: 0 0 22px rgba(94,210,156,0.85); } 100%{ text-shadow: 0 0 0 rgba(94,210,156,0); } }

/* shimmer sweep (top-up button, user card on update) */
.shimmer { position: relative; overflow: hidden; }
.shimmer::after { content:""; position:absolute; top:0; bottom:0; width:40%; left:-50%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.18), transparent); animation: shimmer 3s ease-in-out infinite; }
@keyframes shimmer { 0%{ left:-50%; } 60%,100%{ left:120%; } }

/* floating particles (billing hero) */
.particles { position:absolute; inset:0; overflow:hidden; pointer-events:none; }
.particles i { position:absolute; bottom:-10px; width:4px; height:4px; border-radius:50%; background: var(--brand); opacity:.4; animation: rise linear infinite; }
@keyframes rise { 0%{ transform: translateY(0); opacity:0; } 20%{ opacity:.6; } 100%{ transform: translateY(-220px); opacity:0; } }

/* mesh gradient (billing hero bg) */
.mesh { background-size: 200% 200%; animation: mesh 6s ease infinite; }
@keyframes mesh { 0%{ background-position:0% 50%; } 50%{ background-position:100% 50%; } 100%{ background-position:0% 50%; } }

/* row left-accent slide on hover */
.tbl tbody tr { position: relative; }
.tbl tbody tr::before { content:""; position:absolute; left:0; top:0; bottom:0; width:2px; background: var(--brand); transform: scaleY(0); transform-origin: center; transition: transform .15s var(--ease-out); }
.tbl tbody tr:hover::before { transform: scaleY(1); }

/* notification bell red-dot pulse + hover ring */
.bell-dot { position: relative; }
.bell-dot::after { content:""; position:absolute; inset:0; border-radius:inherit; box-shadow:0 0 0 1px var(--brand); animation: ring 2s ease-out infinite; }

/* tab sliding feel */
.tab-underline { transition: color .2s; }

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}
