:root {
  --bg: #0f0f12;
  --card: #17171d;
  --card-2: #1e1e26;
  --line: #2a2a35;
  --tx: #f5f3ff;
  --tx-soft: #a8a2bd;
  --accent: #7c3aed;
  --accent-2: #a855f7;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(900px 500px at 15% -10%, #2a1547 0%, transparent 60%), var(--bg);
  color: var(--tx);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

button, input, select { font: inherit; }

[hidden] { display: none !important; }

/* ---------- login ---------- */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login__card {
  width: 100%;
  max-width: 380px;
  background: linear-gradient(180deg, #1b1b22, #141419);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.login__brand {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  margin-bottom: 18px;
}

.login h1 { margin: 0 0 6px; font-size: 23px; }

.login p {
  margin: 0 0 20px;
  color: var(--tx-soft);
  font-size: 13.5px;
  line-height: 1.45;
}

.login label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--tx-soft);
  margin-bottom: 14px;
}

.login input {
  width: 100%;
  margin-top: 7px;
  background: #101014;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--tx);
  padding: 12px 13px;
  outline: none;
}

.login input:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.18); }

.login button {
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.login button:disabled { opacity: 0.6; cursor: wait; }

.error { color: #fecdd3 !important; font-weight: 600; min-height: 18px; margin: 0 0 10px !important; }

/* ---------- dashboard ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: rgba(15, 15, 18, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.top__brand { display: flex; align-items: center; gap: 11px; }

.top__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.top__brand strong { display: block; font-size: 14px; }
.top__brand small { display: block; color: var(--tx-soft); font-size: 11.5px; margin-top: 2px; }

.top__actions { display: flex; flex-wrap: wrap; gap: 8px; }

.btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--tx);
  border-radius: 9px;
  padding: 8px 11px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover { border-color: #45455a; }
.btn:disabled { opacity: 0.55; cursor: wait; }
.btn--ghost { background: transparent; }
.btn--small { padding: 5px 8px; font-size: 11.5px; }

.wrap { max-width: 1320px; margin: 0 auto; padding: 22px; }

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-bottom: 18px;
}

.filters label {
  display: grid;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--tx-soft);
}

.filters select {
  min-width: 150px;
  background: var(--card);
  color: var(--tx);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 10px;
  outline: none;
}

.updated { margin-left: auto; color: var(--tx-soft); font-size: 12px; }

.message { min-height: 20px; margin: 0 0 12px; color: #fecdd3; font-size: 13px; }
.message:empty { display: none; }

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.kpi {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.kpi span { display: block; color: var(--tx-soft); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.kpi strong { display: block; font-size: 25px; margin: 8px 0 4px; letter-spacing: -0.02em; }
.kpi small { color: var(--tx-soft); font-size: 11.5px; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 18px;
  overflow: hidden;
}

.panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel__head h2 { margin: 0 0 3px; font-size: 15px; }
.panel__head p { margin: 0; color: var(--tx-soft); font-size: 12px; }

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; min-width: 760px; }

th, td {
  padding: 11px 13px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  white-space: nowrap;
}

th {
  color: var(--tx-soft);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #141419;
}

tbody tr:hover { background: rgba(124, 58, 237, 0.06); }
tbody tr:last-child td { border-bottom: 0; }

.num { text-align: right; }
.muted { color: var(--tx-soft); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge--paid { color: #bbf7d0; background: rgba(34, 197, 94, 0.14); }
.badge--pending { color: #fde68a; background: rgba(245, 158, 11, 0.14); }
.badge--failed { color: #fecdd3; background: rgba(239, 68, 68, 0.14); }
.badge--other { color: #ddd6fe; background: rgba(124, 58, 237, 0.16); }

.chart {
  display: flex;
  align-items: end;
  gap: 8px;
  min-height: 190px;
  padding: 20px 18px 14px;
  overflow-x: auto;
}

.chart__col {
  min-width: 28px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: end;
  gap: 7px;
  height: 155px;
}

.chart__bar {
  width: 100%;
  max-width: 34px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  min-height: 2px;
}

.chart__val { font-size: 9.5px; color: var(--tx-soft); white-space: nowrap; }
.chart__day { font-size: 9.5px; color: var(--tx-soft); }

.empty { padding: 22px 18px; color: var(--tx-soft); font-size: 13px; }

@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top { align-items: flex-start; flex-direction: column; }
  .updated { margin-left: 0; width: 100%; }
}

@media (max-width: 520px) {
  .wrap { padding: 14px; }
  .kpis { grid-template-columns: 1fr; }
  .filters { display: grid; grid-template-columns: 1fr 1fr; }
  .filters label, .filters select { min-width: 0; width: 100%; }
  .updated { grid-column: 1 / -1; }
}

.table-link {
  display: inline-block;
  margin-left: 7px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(124, 58, 237, .14);
  color: #ddd6fe;
  font-size: 10.5px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}
.table-link:hover { background: rgba(124, 58, 237, .28); }
