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

:root {
  --bg: #f3f1fb;
  --card: #ffffff;
  --border: #e6e1f5;
  --text: #241b3d;
  --muted: #83799e;
  --primary: #7c3aed;
  --primary-2: #a855f7;
  --primary-d: #6d28d9;
  --green: #16a34a;
  --green-bg: #dcfce7;
  --red: #e11d48;
  --red-bg: #ffe4e6;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --sidebar: #17092b;
  --sidebar-2: #0e0518;
  --radius: 16px;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: 'Inter', system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); font-size: 15px; }

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

.sidebar {
  width: 248px; flex-shrink: 0;
  background:
    radial-gradient(ellipse at 20% -10%, rgba(168,85,247,.35), transparent 55%),
    linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  color: #b9aede;
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0;
  padding: 24px 14px;
}
.brand {
  color: #fff; text-decoration: none; font-size: 22px; font-weight: 800;
  padding: 4px 12px 22px; letter-spacing: -.4px; display: block;
}
.brand em {
  font-style: normal; font-weight: 500;
  background: linear-gradient(90deg, #c084fc, #f0abfc);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

.side-credits {
  margin: 0 4px 20px; padding: 13px 15px;
  background: rgba(168,85,247,.14); border: 1px solid rgba(192,132,252,.3);
  border-radius: 12px; display: flex; align-items: center; justify-content: space-between;
  backdrop-filter: blur(4px);
}
.side-credits span { font-size: 12px; color: #a99bc9; }
.side-credits b { font-size: 19px; color: #e9d5ff; }

.side-nav { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.side-nav a {
  display: flex; align-items: center; gap: 12px;
  color: #a193c9; text-decoration: none; font-size: 14px; font-weight: 500;
  padding: 11px 13px; border-radius: 10px; transition: all .15s;
}
.side-nav a svg { width: 19px; height: 19px; flex-shrink: 0; }
.side-nav a:hover { background: rgba(168,85,247,.12); color: #fff; }
.side-nav a.active {
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  color: #fff; box-shadow: 0 5px 18px rgba(124,58,237,.45);
}

.side-footer { border-top: 1px solid rgba(255,255,255,.08); padding: 16px 8px 0; }
.side-footer .who { display: flex; flex-direction: column; margin-bottom: 11px; }
.side-footer .who b { color: #fff; font-size: 14px; }
.side-footer .who span { font-size: 12px; color: #8d7fb0; }
.logout {
  display: block; text-align: center; padding: 9px; border-radius: 9px;
  background: rgba(225,29,72,.12); border: 1px solid rgba(225,29,72,.3);
  color: #fb7185; text-decoration: none; font-size: 13px; font-weight: 600; transition: all .15s;
}
.logout:hover { background: rgba(225,29,72,.25); color: #fda4af; }

.content { flex: 1; margin-left: 248px; padding: 30px 36px 60px; min-width: 0; }

/* ---------- Typography / Cards ---------- */
h1 { font-size: 22px; font-weight: 800; margin: 0 0 22px; letter-spacing: -.4px; }
h1 .muted { font-weight: 500; }
h2 { font-size: 15px; font-weight: 700; margin: 0 0 14px; color: #453a63; }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 24px; margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(36,27,61,.06);
}

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; font-weight: 600; margin: 0 0 14px; color: #544970; }
input, textarea, select {
  display: block; width: 100%; margin-top: 6px; padding: 10px 13px;
  border: 1px solid #ddd5ee; border-radius: 10px; font: inherit; font-size: 14px;
  background: #fbfaff; transition: border .15s, box-shadow .15s;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 4px rgba(124,58,237,.13);
}

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 19px; border: 1px solid #ddd5ee; border-radius: 10px;
  background: #fff; font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; text-decoration: none; color: var(--text); transition: all .15s;
}
.btn:hover { border-color: var(--primary-2); color: var(--primary-d); box-shadow: 0 2px 8px rgba(124,58,237,.12); }
.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent; color: #fff;
  box-shadow: 0 5px 15px rgba(124,58,237,.4);
}
.btn.primary:hover { background: linear-gradient(135deg, var(--primary-d), var(--primary)); color:#fff; transform: translateY(-1px); box-shadow: 0 7px 20px rgba(124,58,237,.5); }
.btn.danger { border-color: #fda4af; color: var(--red); }
.btn.danger:hover { background: var(--red-bg); color: var(--red); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px; color: var(--muted);
  border-bottom: 2px solid var(--border);
}
td { padding: 11px 12px; border-bottom: 1px solid #f1edf9; }
tr:hover td { background: #faf8fe; }
tr:last-child td { border-bottom: none; }
td a { color: var(--primary); text-decoration: none; font-weight: 500; }
td a:hover { text-decoration: underline; }

/* ---------- Alerts ---------- */
.alert {
  padding: 13px 17px; border-radius: 12px; margin-bottom: 20px;
  font-size: 14px; border: 1px solid transparent; display: flex; gap: 8px; align-items: flex-start;
}
.alert.ok   { background: var(--green-bg); color: #14532d; border-color: #bbf7d0; }
.alert.err  { background: var(--red-bg);   color: #881337; border-color: #fecdd3; }
.alert.info { background: #ede9fe;         color: #4c1d95; border-color: #ddd6fe; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 4px 11px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.badge.sent, .badge.completed, .badge.active { background: var(--green-bg); color: var(--green); }
.badge.failed, .badge.suspended { background: var(--red-bg); color: var(--red); }
.badge.pending, .badge.processing { background: var(--amber-bg); color: var(--amber); }
.badge.admin { background: #ede9fe; color: var(--primary-d); }
.badge.customer { background: #e0f2fe; color: #0369a1; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-bottom: 24px; }
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: 0 1px 4px rgba(36,27,61,.06); position: relative; overflow: hidden;
}
.stat::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary), #d946ef);
}
.stat .num { font-size: 30px; font-weight: 800; letter-spacing: -.5px; }
.stat .lbl { font-size: 13px; color: var(--muted); margin-top: 3px; font-weight: 500; }

/* ---------- Charts ---------- */
.charts { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 20px; }
.chart-box { position: relative; height: 250px; }
@media (max-width: 860px) { .charts { grid-template-columns: 1fr; } }

/* ---------- Misc ---------- */
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 230px; }
.muted { color: var(--muted); font-size: 13px; font-weight: 400; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; word-break: break-all; }
details summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--primary); }
details pre { background: #faf8fe; border: 1px solid var(--border); border-radius: 10px; padding: 14px; max-height: 300px; overflow: auto; }

/* ---------- Login ---------- */
.login-body {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background:
    radial-gradient(ellipse at 15% 20%, rgba(168,85,247,.4), transparent 50%),
    radial-gradient(ellipse at 85% 80%, rgba(217,70,239,.3), transparent 45%),
    linear-gradient(140deg, #17092b 0%, #2e1065 55%, #4c1d95 100%);
  padding: 20px;
}
.login-card {
  background: #fff; border-radius: 20px; padding: 42px 40px; width: 410px;
  box-shadow: 0 30px 70px rgba(20,5,45,.5);
}
.login-card .logo { text-align: center; font-size: 27px; font-weight: 800; letter-spacing: -.4px; margin-bottom: 4px; }
.login-card .logo em { font-style: normal; font-weight: 400; color: var(--primary); }
.login-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 28px; }
.login-card .btn { width: 100%; justify-content: center; padding: 12px; }

.dev-creds {
  margin-top: 22px; padding: 14px 16px;
  background: #fdf7e8; border: 1px dashed #e8c96a; border-radius: 12px;
}
.dev-creds-title { font-size: 12px; font-weight: 700; color: #92600a; margin-bottom: 9px; }
.dev-creds-title span { font-weight: 400; text-transform: uppercase; font-size: 10px; letter-spacing: .5px; }
.dev-cred { display: flex; align-items: center; gap: 9px; padding: 5px 0; font-size: 13px; }
.dev-cred code {
  background: #fff; border: 1px solid #ecd9a0; border-radius: 6px;
  padding: 3px 9px; font-size: 12.5px; min-width: 105px;
}
.dev-cred .badge { margin-left: auto; }

/* ---------- Packages ---------- */
.pkg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 18px; margin-bottom: 24px; }
.pkg-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px 20px; text-align: center; box-shadow: 0 1px 4px rgba(36,27,61,.06);
  transition: transform .15s, box-shadow .15s; position: relative; overflow: hidden;
}
.pkg-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary), #d946ef); opacity: 0; transition: opacity .15s;
}
.pkg-card:hover { transform: translateY(-4px); box-shadow: 0 12px 28px rgba(124,58,237,.18); border-color: #ddd6fe; }
.pkg-card:hover::before { opacity: 1; }
.pkg-name { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; color: var(--primary); }
.pkg-credits { font-size: 31px; font-weight: 800; letter-spacing: -.5px; margin-top: 8px; }
.pkg-sub { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.pkg-price {
  font-size: 21px; font-weight: 800; margin-bottom: 16px;
  background: linear-gradient(90deg, var(--primary), #d946ef);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.pkg-price span { font-size: 13px; -webkit-text-fill-color: var(--muted); font-weight: 600; }

.theme-preview { height: 90px; border-radius: 10px; margin-bottom: 14px; }

.nav-badge {
  margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 19px; height: 19px; border-radius: 10px; display: inline-flex;
  align-items: center; justify-content: center; padding: 0 5px;
}

.addr-box {
  margin-top: 9px; padding: 11px 14px; background: #fff; border: 1px solid #ddd6fe;
  border-radius: 10px; font-family: ui-monospace, Consolas, monospace; font-size: 14px;
  cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  word-break: break-all;
}
.addr-box:hover { background: #f5f3ff; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar { position: static; width: 100%; padding: 14px; }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-nav a { padding: 8px 12px; }
  .side-nav a span { font-size: 13px; }
  .nav-badge { margin-left: 4px; }
  .side-credits { margin: 0 0 10px; }
  .content { margin-left: 0; padding: 20px 16px 50px; }
}
