@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --c1: #0A1628;
  --c2: #112240;
  --c3: #1B3A5C;
  --accent: #10B981;
  --accent2: #059669;
  --accent-glow: rgba(16,185,129,.12);
  --gold: #F59E0B;
  --red: #EF4444;
  --blue: #3B82F6;
  --bg: #F1F5F9;
  --card: #FFFFFF;
  --border: #E2E8F0;
  --border2: #F1F5F9;
  --txt: #0F172A;
  --txt2: #64748B;
  --txt3: #94A3B8;
  --font: 'Outfit', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --r: 10px;
  --r2: 14px;
  --r3: 20px;
  --sh1: 0 1px 2px rgba(0,0,0,.04);
  --sh2: 0 4px 12px rgba(0,0,0,.06);
  --sh3: 0 8px 30px rgba(0,0,0,.08);
  --sidebar-w: 256px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: var(--font); background: var(--bg); color: var(--txt); line-height: 1.6; -webkit-font-smoothing: antialiased; }
h1,h2,h3,h4,h5 { font-weight: 700; line-height: 1.25; color: var(--c1); }
a { color: var(--accent2); text-decoration: none; }
a:hover { color: var(--accent); }

/* ═══════════════════════════════════════════════════════
   AUTH PAGES
   ═══════════════════════════════════════════════════════ */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--c1);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(16,185,129,.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(59,130,246,.06) 0%, transparent 50%);
  padding: 1.5rem;
}
.auth-box {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: var(--r3);
  padding: 2.5rem 2rem;
  box-shadow: var(--sh3);
  animation: fadeUp .4s ease;
}
@keyframes fadeUp { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }
.auth-box.wide { max-width: 480px; }
.auth-head { text-align: center; margin-bottom: 2rem; }
.auth-head .logo-mark {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: var(--r);
  display: inline-grid; place-items: center;
  margin-bottom: .8rem;
}
.auth-head .logo-mark svg { width: 26px; height: 26px; stroke: white; fill: none; }
.auth-head h1 { font-size: 1.35rem; margin-bottom: .15rem; }
.auth-head p { color: var(--txt2); font-size: .88rem; }
.auth-foot { text-align: center; margin-top: 1.5rem; font-size: .88rem; color: var(--txt2); }
.auth-foot a { font-weight: 600; }

/* ═══════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════ */
.fg { margin-bottom: 1.1rem; }
.fg label { display: block; font-weight: 600; font-size: .82rem; margin-bottom: .3rem; color: var(--txt); }
.fc {
  width: 100%; padding: .7rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  font-family: var(--font);
  font-size: .92rem;
  background: var(--bg);
  color: var(--txt);
  transition: border .15s, box-shadow .15s;
  outline: none;
}
.fc:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); background: #fff; }
.fc::placeholder { color: var(--txt3); }
select.fc { cursor: pointer; }
textarea.fc { resize: vertical; min-height: 80px; }
.fc-hint { font-size: .75rem; color: var(--txt3); margin-top: .2rem; }
.fr { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
@media (max-width:520px) { .fr { grid-template-columns: 1fr; } }

/* ═══════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .65rem 1.3rem;
  border: none; border-radius: var(--r);
  font-family: var(--font); font-weight: 600; font-size: .88rem;
  cursor: pointer; transition: all .15s; text-decoration: none; white-space: nowrap;
}
.btn-p { background: var(--accent); color: #fff; }
.btn-p:hover { background: var(--accent2); box-shadow: 0 4px 14px rgba(16,185,129,.25); transform: translateY(-1px); color: #fff; }
.btn-s { background: var(--card); color: var(--txt); border: 1.5px solid var(--border); }
.btn-s:hover { background: var(--bg); color: var(--txt); }
.btn-d { background: var(--red); color: #fff; }
.btn-d:hover { background: #DC2626; color: #fff; }
.btn-w { background: var(--gold); color: #fff; }
.btn-sm { padding: .4rem .8rem; font-size: .78rem; }
.btn-lg { padding: .85rem 1.8rem; font-size: .95rem; }
.btn-bl { width: 100%; }

/* ═══════════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════════ */
.alert {
  padding: .85rem 1rem;
  border-radius: var(--r);
  font-size: .88rem;
  margin-bottom: 1.2rem;
  border-left: 4px solid;
  animation: fadeUp .3s ease;
}
.alert--ok  { background: rgba(16,185,129,.06); border-color: var(--accent); color: #065F46; }
.alert--err { background: rgba(239,68,68,.06);  border-color: var(--red);    color: #991B1B; }
.alert--warn{ background: rgba(245,158,11,.06); border-color: var(--gold);   color: #92400E; }
.alert--info{ background: rgba(59,130,246,.06);  border-color: var(--blue);   color: #1E40AF; }

/* ═══════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════ */
.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sb {
  width: var(--sidebar-w);
  background: var(--c1);
  position: fixed; top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column;
  z-index: 100;
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}
.sb-head {
  padding: 1.2rem 1.2rem;
  display: flex; align-items: center; gap: .7rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sb-head .sb-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 8px;
  display: grid; place-items: center; flex-shrink: 0;
}
.sb-head .sb-icon svg { width: 20px; height: 20px; stroke: #fff; fill: none; }
.sb-head .sb-brand h2 { font-size: .9rem; color: #fff; font-weight: 700; line-height: 1.2; margin: 0; }
.sb-head .sb-brand small { font-size: .6rem; color: rgba(255,255,255,.4); text-transform: uppercase; letter-spacing: 1px; }

.sb-nav { flex: 1; padding: .8rem 0; overflow-y: auto; }
.sb-nav::-webkit-scrollbar { width: 0; }
.sb-sec { padding: 0 .8rem; margin-bottom: .3rem; }
.sb-sec-t { font-size: .6rem; text-transform: uppercase; letter-spacing: .8px; color: rgba(255,255,255,.28); padding: .8rem .6rem .3rem; font-weight: 600; }
.sb-nav a {
  display: flex; align-items: center; gap: .65rem;
  padding: .55rem .65rem;
  border-radius: 8px;
  color: rgba(255,255,255,.6);
  font-size: .85rem; font-weight: 500;
  transition: all .12s;
  margin-bottom: 1px;
}
.sb-nav a:hover { background: rgba(255,255,255,.05); color: rgba(255,255,255,.9); }
.sb-nav a.on { background: rgba(16,185,129,.12); color: #6EE7B7; }
.sb-nav a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .65; }
.sb-nav a.on svg { opacity: 1; }
.sb-nav a .cnt {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  padding: .1rem .45rem;
  border-radius: 8px;
  line-height: 1.4;
}

.sb-foot {
  padding: 1rem;
  border-top: 1px solid rgba(255,255,255,.06);
}
.sb-user { display: flex; align-items: center; gap: .6rem; }
.sb-av {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent2), #047857);
  display: grid; place-items: center;
  font-size: .72rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.sb-user .sb-name { font-size: .82rem; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user .sb-role { font-size: .68rem; color: rgba(255,255,255,.4); }

/* Main */
.main { flex: 1; margin-left: var(--sidebar-w); min-height: 100vh; }
.topbar {
  height: 60px;
  background: var(--card);
  border-bottom: 1px solid var(--border2);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.8rem;
  position: sticky; top: 0; z-index: 50;
}
.topbar h1 { font-size: 1.05rem; }
.topbar h1 small { display: block; font-size: .72rem; font-weight: 400; color: var(--txt2); }
.tb-acts { display: flex; align-items: center; gap: .8rem; }
.tb-bell {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  cursor: pointer; position: relative;
  transition: .15s;
}
.tb-bell:hover { background: var(--border2); }
.tb-bell svg { width: 16px; height: 16px; stroke: var(--txt2); fill: none; }
.tb-bell .dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; background: var(--red); border-radius: 50%; border: 2px solid var(--card); }
.ham { display: none; background: none; border: none; cursor: pointer; padding: .4rem; }
.ham svg { width: 22px; height: 22px; stroke: var(--txt); }

.page { padding: 1.5rem 1.8rem; }

/* ═══════════════════════════════════════════════════════
   CARDS & STAT CARDS
   ═══════════════════════════════════════════════════════ */
.card { background: var(--card); border-radius: var(--r2); border: 1px solid var(--border2); box-shadow: var(--sh1); }
.card-h { padding: 1rem 1.2rem; border-bottom: 1px solid var(--border2); display: flex; align-items: center; justify-content: space-between; }
.card-h h3 { font-size: .92rem; margin: 0; }
.card-b { padding: 1.2rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px,1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat {
  background: var(--card);
  border-radius: var(--r2);
  padding: 1.2rem;
  border: 1px solid var(--border2);
  box-shadow: var(--sh1);
  display: flex; align-items: flex-start; gap: .8rem;
  transition: box-shadow .15s, transform .15s;
}
.stat:hover { box-shadow: var(--sh2); transform: translateY(-2px); }
.stat-ic {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.stat-ic svg { width: 20px; height: 20px; }
.stat-ic.gr { background: rgba(16,185,129,.1); color: var(--accent); }
.stat-ic.bl { background: rgba(59,130,246,.1); color: var(--blue); }
.stat-ic.or { background: rgba(245,158,11,.1); color: var(--gold); }
.stat-ic.rd { background: rgba(239,68,68,.1); color: var(--red); }
.stat-ic.dk { background: rgba(15,23,42,.06); color: var(--c1); }
.stat-ic svg { stroke: currentColor; fill: none; }
.stat-lb { font-size: .75rem; color: var(--txt2); font-weight: 500; margin-bottom: .15rem; }
.stat-val { font-size: 1.35rem; font-weight: 800; color: var(--c1); line-height: 1.2; }

/* Balance Hero */
.hero {
  background: linear-gradient(135deg, var(--c1) 0%, var(--c2) 50%, var(--c3) 100%);
  border-radius: var(--r3);
  padding: 2rem 2.2rem;
  color: #fff;
  position: relative;
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.hero::after {
  content: '';
  position: absolute; top: -40%; right: -15%;
  width: 50%; height: 180%;
  background: radial-gradient(ellipse, rgba(16,185,129,.12), transparent 70%);
  pointer-events: none;
}
.hero-lbl { font-size: .82rem; opacity: .6; margin-bottom: .4rem; }
.hero-amt { font-size: 2.4rem; font-weight: 800; margin-bottom: .3rem; }
.hero-acc { font-size: .82rem; opacity: .5; }
.hero-btns { display: flex; gap: .7rem; margin-top: 1.3rem; position: relative; z-index: 1; }
.hero-btns .btn-p { background: var(--accent); }
.hero-btns .btn-ghost { background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.15); }
.hero-btns .btn-ghost:hover { background: rgba(255,255,255,.18); color: #fff; }

/* ═══════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════ */
.tw { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table thead th {
  background: var(--bg);
  font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--txt2);
  padding: .75rem .9rem;
  text-align: left;
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}
table td {
  padding: .75rem .9rem;
  border-bottom: 1px solid var(--border2);
  font-size: .85rem;
  vertical-align: middle;
}
table tr:hover td { background: rgba(0,0,0,.01); }
table tr:last-child td { border-bottom: none; }

/* Status pills */
.pill {
  display: inline-flex; align-items: center;
  padding: .18rem .6rem;
  border-radius: 20px;
  font-size: .68rem; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.pill--ok   { background: rgba(16,185,129,.1); color: #059669; }
.pill--warn { background: rgba(245,158,11,.1); color: #B45309; }
.pill--bad  { background: rgba(239,68,68,.1);  color: #DC2626; }
.pill--mute { background: rgba(100,116,139,.1); color: var(--txt2); }
.pill--info { background: rgba(59,130,246,.1);  color: #2563EB; }

/* Money */
.money { font-weight: 700; font-family: var(--font); }
.money.cr { color: var(--accent2); }
.money.dr { color: var(--red); }
.mono { font-family: var(--mono); font-size: .8rem; }

/* Pagination */
.pager { display: flex; align-items: center; justify-content: center; gap: .3rem; margin-top: 1.3rem; }
.pager a, .pager span {
  display: inline-grid; place-items: center;
  min-width: 34px; height: 34px;
  border-radius: 8px;
  font-size: .82rem; font-weight: 600;
  color: var(--txt2);
  border: 1px solid var(--border);
  transition: .12s;
}
.pager a:hover { background: var(--bg); border-color: var(--accent); color: var(--txt); }
.pager .on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Filters */
.filters { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.filters .fc { max-width: 220px; padding: .55rem .8rem; font-size: .82rem; }

/* Grid layouts */
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
@media (max-width:860px) { .g2 { grid-template-columns: 1fr; } }

.mb1 { margin-bottom: .5rem; }
.mb2 { margin-bottom: 1rem; }
.mb3 { margin-bottom: 1.5rem; }
.mt2 { margin-top: 1rem; }
.tac { text-align: center; }
.tar { text-align: right; }
.fw7 { font-weight: 700; }

/* Empty state */
.empty { text-align: center; padding: 3rem 1.5rem; color: var(--txt3); }
.empty svg { width: 56px; height: 56px; opacity: .25; margin-bottom: .8rem; }
.empty h4 { color: var(--txt2); margin-bottom: .3rem; }
.empty p { font-size: .85rem; }

/* Modal */
.modal-bg {
  display: none; position: fixed; inset: 0;
  background: rgba(10,22,40,.55);
  backdrop-filter: blur(3px);
  z-index: 1000; place-items: center;
}
.modal-bg.open { display: grid; }
.modal {
  background: var(--card);
  border-radius: var(--r3);
  box-shadow: var(--sh3);
  width: 90%; max-width: 500px;
  max-height: 90vh; overflow-y: auto;
  animation: fadeUp .25s ease;
}
.modal-h { padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--border2); display: flex; align-items: center; justify-content: space-between; }
.modal-h h3 { font-size: 1rem; margin: 0; }
.modal-x { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--txt3); line-height: 1; }
.modal-b { padding: 1.3rem; }
.modal-f { padding: .8rem 1.3rem; border-top: 1px solid var(--border2); display: flex; justify-content: flex-end; gap: .5rem; }

/* Notification list */
.noti { padding: .85rem 1rem; border-bottom: 1px solid var(--border2); display: flex; gap: .7rem; }
.noti:last-child { border-bottom: none; }
.noti-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: .4rem; flex-shrink: 0; }
.noti-dot.success { background: var(--accent); }
.noti-dot.warning { background: var(--gold); }
.noti-dot.danger  { background: var(--red); }
.noti-dot.info    { background: var(--blue); }
.noti h5 { font-size: .83rem; margin-bottom: .1rem; }
.noti p { font-size: .78rem; color: var(--txt2); margin: 0; }
.noti .noti-t { font-size: .68rem; color: var(--txt3); margin-top: .2rem; }

/* Install page */
.inst-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--bg); padding: 1.5rem; }
.inst-box { background: var(--card); border-radius: var(--r3); box-shadow: var(--sh2); width: 100%; max-width: 580px; padding: 2.5rem 2rem; }
.inst-box h1 { text-align: center; margin-bottom: .3rem; }
.inst-sub { text-align: center; color: var(--txt2); margin-bottom: 2rem; }
.steps { display: flex; justify-content: center; gap: .4rem; margin-bottom: 2rem; }
.steps .s { width: 40px; height: 4px; border-radius: 2px; background: var(--border); }
.steps .s.on { background: var(--accent); }
.steps .s.done { background: var(--c1); }
.chk-list { list-style: none; }
.chk-list li { padding: .55rem 0; display: flex; align-items: center; gap: .65rem; font-size: .88rem; border-bottom: 1px solid var(--border2); }
.chk-list .ok { color: var(--accent); font-weight: 700; }
.chk-list .fail { color: var(--red); font-weight: 700; }

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════ */
.sb-over { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 99; }
.sb-over.show { display: block; }

@media (max-width:768px) {
  .sb { transform: translateX(-100%); }
  .sb.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .ham { display: block; }
  .page { padding: 1rem; }
  .topbar { padding: 0 1rem; }
  .stats { grid-template-columns: 1fr; }
  .hero { padding: 1.5rem; }
  .hero-amt { font-size: 1.8rem; }
  .hero-btns { flex-direction: column; }
  .hero-btns .btn { width: 100%; }
  .filters { flex-direction: column; }
  .filters .fc { max-width: none; width: 100%; }
  .auth-box { padding: 2rem 1.3rem; }
  .fr { grid-template-columns: 1fr; }
}
