:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.screen { display: none; }
.screen.active { display: flex; }

/* Login */
#login-screen {
  justify-content: center; align-items: center; min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
}
.login-card {
  background: var(--surface); padding: 2rem; border-radius: var(--radius);
  width: 90%; max-width: 400px; text-align: center; box-shadow: var(--shadow);
}
.login-card h1 { font-size: 1.8rem; margin-bottom: 0.5rem; color: var(--primary); }
.login-card p { color: var(--text-muted); margin-bottom: 1.5rem; }
.login-card input {
  width: 100%; padding: 0.8rem; margin: 0.5rem 0; border: none;
  background: #0f172a; color: var(--text); border-radius: 8px;
}
.login-card button {
  width: 100%; padding: 0.8rem; background: var(--primary); color: white;
  border: none; border-radius: 8px; font-weight: 600; cursor: pointer; margin-top: 1rem;
}
.hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 1rem; }

/* Dashboard Layout */
#dashboard { flex: 1; }
.sidebar {
  width: 240px; background: var(--surface); padding: 1.5rem; height: 100vh;
  position: fixed; left: 0; top: 0; border-right: 1px solid #334155;
}
.logo { font-size: 1.4rem; font-weight: 700; color: var(--primary); margin-bottom: 2rem; text-align: center; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px; padding: 0.8rem 1rem;
  color: var(--text-muted); text-decoration: none; border-radius: 8px; margin-bottom: 0.5rem; transition: 0.2s;
}
.sidebar nav a:hover, .sidebar nav a.active { background: #334155; color: var(--text); }
.content { margin-left: 240px; padding: 2rem; min-height: 100vh; }

header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.3s; }

/* Cards & Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.card { background: var(--surface); padding: 1.5rem; border-radius: var(--radius); box-shadow: var(--shadow); }
.stat { display: flex; align-items: center; gap: 1rem; }
.stat i { font-size: 2rem; color: var(--primary); }
.stat h3 { font-size: 1rem; color: var(--text-muted); }
.stat p { font-size: 1.8rem; font-weight: 700; }

/* Tables & Tools */
.toolbar { display: flex; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.toolbar input, .toolbar button { padding: 0.6rem 1rem; border: none; border-radius: 8px; }
.toolbar input { background: #0f172a; color: var(--text); flex: 1; }
.toolbar button { background: var(--primary); color: white; cursor: pointer; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.8rem; text-align: left; border-bottom: 1px solid #334155; }
th { color: var(--text-muted); font-weight: 500; }
.status-active { color: var(--success); font-weight: 600; }
.status-expired { color: var(--danger); font-weight: 600; }

/* Plans Grid */
.grid-plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.plan-card { background: var(--surface); padding: 1.5rem; border-radius: var(--radius); text-align: center; border: 2px solid transparent; transition: 0.2s; }
.plan-card:hover { border-color: var(--primary); transform: translateY(-3px); }
.plan-card h3 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.plan-card .price { font-size: 2rem; font-weight: 700; color: var(--success); margin: 0.5rem 0; }
.plan-card ul { list-style: none; margin: 1rem 0; color: var(--text-muted); text-align: left; }
.plan-card li::before { content: "✓ "; color: var(--success); }

/* Modal */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: flex; justify-content: center; align-items: center; z-index: 100;
}
.modal-content {
  background: var(--surface); padding: 2rem; border-radius: var(--radius); width: 90%; max-width: 500px;
}
.modal-content input, .modal-content select { width: 100%; padding: 0.8rem; margin: 0.5rem 0; background: #0f172a; color: var(--text); border: none; border-radius: 8px; }
.modal-content button { width: 100%; padding: 0.8rem; background: var(--primary); color: white; border: none; border-radius: 8px; margin-top: 1rem; cursor: pointer; }
.secondary { background: #475569 !important; margin-top: 0.5rem !important; }

.hidden { display: none !important; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { width: 100%; height: auto; position: relative; padding: 1rem; }
  .content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr; }
}