:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1e222b;
  --border: #2a2f3a;
  --text: #e8eaf0;
  --muted: #9aa3b2;
  --accent: #4f46e5;
  --accent-2: #6366f1;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.25);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* top bar */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.brand a { color: var(--text); }
.nav-links { display: flex; gap: 16px; }
.nav-links a { color: var(--muted); font-weight: 500; }
.nav-links a:hover { color: var(--text); }
.user-chip {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.user-name { color: var(--muted); font-size: 13px; }

/* layout */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 24px;
}
.container-fluid { max-width: 1200px; }

.page-head h1 { margin: 0 0 4px; font-size: 26px; }
.muted { color: var(--muted); }
.notice {
  background: rgba(22,163,74,.12);
  border: 1px solid rgba(22,163,74,.4);
  color: #86efac;
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 14px;
}

/* auth cards */
.auth-card {
  max-width: 420px;
  margin: 48px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px;
  box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0 0 8px; font-size: 22px; }
.auth-links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  font-size: 13px;
}

/* forms */
.form { display: grid; gap: 14px; margin-top: 20px; }
.form label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.form input, .form select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  width: 100%;
}
.form input:focus, .form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,70,229,.25);
}
.form-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}
.form-inline label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.form-inline input, .form-inline select { width: auto; min-width: 130px; }
.checkbox { flex-direction: row; align-items: center; gap: 8px; }
.checkbox input { width: auto; }

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.btn:hover { border-color: #3d4452; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-2); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-danger { color: #fca5a5; border-color: rgba(220,38,38,.5); }

/* app grid */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 24px;
}
.app-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  color: var(--text);
  transition: border-color .15s, transform .15s;
}
.app-card:hover {
  text-decoration: none;
  border-color: var(--accent);
  transform: translateY(-2px);
}
.app-card.locked { opacity: .45; pointer-events: none; }
.app-icon { font-size: 26px; margin-bottom: 10px; }
.app-name { font-weight: 600; font-size: 15px; }
.app-desc { color: var(--muted); font-size: 13px; margin-top: 4px; }
.badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  margin-left: 6px;
  vertical-align: middle;
}

/* tables */
section { margin-bottom: 40px; }
section h2 { margin: 0 0 14px; font-size: 18px; }
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
th, td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
th { background: var(--surface-2); color: var(--muted); font-weight: 600; }
tbody tr:last-child td { border-bottom: none; }
td code {
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 12px;
}
.row-actions { display: flex; gap: 8px; }
.row-actions form { margin: 0; }

.status { font-size: 12px; padding: 2px 8px; border-radius: 999px; }
.status-active { background: rgba(22,163,74,.15); color: #86efac; }
.status-pending { background: rgba(202,138,4,.15); color: #fde68a; }
.status-s suspended { background: rgba(220,38,38,.15); color: #fca5a5; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

@media (max-width: 640px) {
  .topbar { padding: 0 14px; gap: 12px; }
  .user-name, .nav-links a { display: none; }
  .container { padding: 24px 14px; }
  .form-inline input, .form-inline select { min-width: 100%; }
}
