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

:root {
  --bg: #070912;
  --bg-2: #0d111f;
  --panel: #13192b;
  --panel-2: #1b233a;
  --border: #1f2942;
  --text: #f4f6fb;
  --muted: #8b95ad;
  --cyan: #00e5ff;
  --cyan-2: #00b8d4;
  --purple: #8b5cf6;
  --green: #00d084;
  --red: #ff4d6d;
  --amber: #ffcc00;
  --shadow: 0 8px 32px rgba(0,0,0,0.45);
  --radius: 16px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: 64px 1fr;
  min-height: 100vh;
}

/* Top bar */
.top-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  background: rgba(7,9,18,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.top-bar-left { display: flex; align-items: center; gap: 16px; }
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.15rem; letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.badge {
  padding: 4px 12px; border-radius: 999px; font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  background: rgba(0,229,255,0.12); color: var(--cyan); border: 1px solid rgba(0,229,255,0.2);
}
.badge-paid { background: rgba(0,208,132,0.12); color: var(--green); border-color: rgba(0,208,132,0.25); }
.badge-pending { background: rgba(255,204,0,0.12); color: var(--amber); border-color: rgba(255,204,0,0.25); }
.badge-active { background: rgba(139,149,173,0.12); color: var(--muted); border-color: rgba(139,149,173,0.2); }

.top-bar-right { display: flex; align-items: center; gap: 12px; }
.user-name { color: var(--muted); font-size: 0.85rem; }

/* Side nav */
.side-nav {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 18px 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 12px;
  color: var(--muted); font-weight: 500; font-size: 0.92rem;
  cursor: pointer; transition: 0.18s; border: none; background: transparent;
  width: 100%; text-align: left;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: linear-gradient(135deg, rgba(0,229,255,0.12), rgba(139,92,246,0.12)); color: var(--cyan); }

/* Main */
.main { padding: 24px; overflow-y: auto; background: var(--bg); }
.page-title {
  font-size: 1.45rem; font-weight: 700; margin: 0 0 20px 0;
  letter-spacing: -0.5px;
}
.page-sub {
  color: var(--muted); font-size: 0.92rem; margin-top: -14px; margin-bottom: 24px;
}

/* Hero summary */
.hero-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}
.hero-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.hero-card::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at top right, rgba(0,229,255,0.08), transparent 60%);
}
.hero-label { font-size: 0.75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.hero-value { font-size: 1.8rem; font-weight: 800; letter-spacing: -1px; }
.hero-sub { font-size: 0.8rem; color: var(--muted); margin-top: 6px; }

/* Progress ring */
.ring-wrap {
  display: flex; align-items: center; gap: 16px;
}
.ring {
  width: 64px; height: 64px; border-radius: 50%;
  background: conic-gradient(var(--cyan) var(--pct), var(--panel-2) var(--pct));
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.ring::after {
  content: ''; width: 50px; height: 50px; border-radius: 50%;
  background: var(--panel); position: absolute;
}
.ring-text {
  position: relative; z-index: 1;
  font-size: 0.8rem; font-weight: 700; color: var(--cyan);
}

/* Cards grid */
.grid-5, .grid-4, .grid-3 {
  display: grid; gap: 16px; margin-bottom: 24px;
}
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow);
  transition: transform 0.15s;
}
.card:hover { transform: translateY(-2px); }
.card-title { font-size: 0.75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin: 0 0 10px; }
.card-value { font-size: 1.45rem; font-weight: 800; margin: 0; letter-spacing: -0.5px; }
.card-sub { font-size: 0.78rem; color: var(--muted); margin: 8px 0 0; }

/* Sections */
.detail-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.detail-section h3 { margin: 0 0 18px; font-size: 1.05rem; font-weight: 700; }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--border); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; min-width: 680px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--panel-2); color: var(--muted); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.5px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(0,229,255,0.03); }
.money-positive { color: var(--green); font-weight: 700; }
.money-negative { color: var(--red); font-weight: 700; }

/* Buttons */
.btn {
  padding: 10px 16px; border-radius: 10px; border: none; cursor: pointer;
  font-weight: 600; font-size: 0.82rem; transition: 0.15s;
}
.btn-primary { background: linear-gradient(135deg, var(--cyan), var(--cyan-2)); color: #000; }
.btn-success { background: linear-gradient(135deg, var(--green), #00b86b); color: #000; }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 7px 12px; font-size: 0.75rem; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Form */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
label { font-size: 0.78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
input, select, textarea {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 13px; color: var(--text); font-size: 0.92rem;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cyan); }
textarea { min-height: 80px; resize: vertical; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.75);
  display: flex; align-items: center; justify-content: center; z-index: 200;
}
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; width: min(520px, 92vw); max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal h3 { margin-top: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* Login */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 0%, rgba(0,229,255,0.1), transparent 50%);
}
.login-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 36px; width: min(400px, 92vw); box-shadow: var(--shadow);
}
.login-card h2 { margin-top: 0; font-size: 1.5rem; }
.login-card .brand { font-size: 1.4rem; margin-bottom: 8px; }
.error-text { color: var(--red); font-size: 0.88rem; }
.empty { color: var(--muted); font-style: italic; padding: 20px 0; }

/* Status chips */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 0.7rem; font-weight: 700; }
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; }
.chip-active { background: rgba(0,208,132,0.12); color: var(--green); }
.chip-active::before { background: var(--green); box-shadow: 0 0 8px var(--green); }
.chip-pending { background: rgba(255,204,0,0.12); color: var(--amber); }
.chip-pending::before { background: var(--amber); }
.chip-expired { background: rgba(255,77,109,0.12); color: var(--red); }
.chip-expired::before { background: var(--red); }

/* Mobile */
@media (max-width: 1024px) {
  .app-shell { grid-template-columns: 1fr; grid-template-rows: 64px 1fr; }
  .side-nav { display: none; }
  .hero-row { grid-template-columns: repeat(2, 1fr); }
  .grid-5 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .main { padding: 16px; }
  .hero-row { grid-template-columns: 1fr; }
  .grid-5, .grid-4 { grid-template-columns: 1fr; }
  .hero-value { font-size: 1.45rem; }
}
