*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #0f1425;
  color: #f0f4ff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header / Footer */
.site-header, .site-footer {
  padding: 1rem 2rem;
  background: rgba(15, 20, 37, 0.8);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.site-footer { border-top: 1px solid rgba(255, 255, 255, 0.1); border-bottom: none; margin-top: auto; font-size: 0.85rem; color: rgba(255,255,255,0.4); }
.brand { font-weight: 700; letter-spacing: 0.2em; font-size: 1.1rem; }
nav { display: flex; gap: 0.75rem; align-items: center; }
.nav-link { color: #8ab4ff; text-decoration: none; font-size: 0.9rem; }
.nav-link:hover { color: #fff; }
.user-chip { font-size: 0.85rem; color: rgba(255,255,255,0.5); margin-right: 0.5rem; }
.inline-form { display: inline; }

/* Buttons */
.btn {
  display: inline-block;
  border: none;
  padding: 0.65rem 1.2rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  background: #1f2740;
  color: #fff;
  text-decoration: none;
  text-align: center;
  transition: opacity 0.2s;
}
.btn:hover { opacity: 0.85; }
.btn.primary { background: linear-gradient(135deg, #3570ff, #23c0ff); }
.btn.ghost { background: transparent; border: 1px solid rgba(255, 255, 255, 0.2); }
.btn.danger { background: #c0392b; }
.btn.tiny { font-size: 0.75rem; padding: 0.25rem 0.5rem; }

/* Layout */
.main { padding: 2rem; max-width: 1200px; width: 100%; margin: 0 auto; flex: 1; }

/* Cards */
.card {
  background: rgba(18, 23, 45, 0.9);
  padding: 2.5rem;
  border-radius: 1rem;
  box-shadow: 0 15px 40px rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.06);
}

/* Login */
.login-card {
  max-width: 420px;
  margin: 6rem auto 2rem;
}
.login-card h1 {
  font-size: 1.5rem;
  margin-bottom: 1.75rem;
  text-align: center;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}
.form-group label,
.form-grid label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
  margin-bottom: 0.4rem;
}
input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"] {
  display: block;
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 0.95rem;
  transition: border-color 0.2s;
  outline: none;
}
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="url"]:focus {
  border-color: #3570ff;
}
.login-card form .btn.primary {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.75rem;
  font-size: 1rem;
}
.form-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
label.checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #f0f4ff;
}

/* Flash */
.flash { padding: 1rem; border-radius: 0.6rem; margin-bottom: 1.5rem; font-size: 0.9rem; }
.flash.success { background: rgba(46, 204, 113, 0.15); border: 1px solid rgba(46, 204, 113, 0.3); }
.flash.error { background: rgba(231, 76, 60, 0.15); border: 1px solid rgba(231, 76, 60, 0.3); }

/* App Grid */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.app-card {
  background: rgba(18, 23, 45, 0.9);
  border-radius: 1rem;
  padding: 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(255,255,255,0.08);
  transition: transform 0.2s, border-color 0.2s;
}
.app-card:hover { transform: translateY(-4px); border-color: rgba(53,112,255,0.6); }
.app-card .icon { font-size: 2rem; flex-shrink: 0; }
.app-card h2 { font-size: 1.1rem; margin-bottom: 0.25rem; }
.app-card p { font-size: 0.85rem; color: rgba(255,255,255,0.5); }
.admin-actions { margin-top: 0.75rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Access Denied */
.access-denied { text-align: center; max-width: 500px; margin: 6rem auto; }
.access-denied .icon { font-size: 3rem; margin-bottom: 1rem; }
.access-denied h1 { margin-bottom: 0.75rem; }
.access-denied p { color: rgba(255,255,255,0.6); margin-bottom: 1.5rem; }

/* Tables */
table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
th, td { padding: 0.75rem; border-bottom: 1px solid rgba(255,255,255,0.08); text-align: left; font-size: 0.9rem; }
th { color: rgba(255,255,255,0.5); font-weight: 500; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.actions { display: flex; gap: 0.4rem; }
.actions form { display: inline-block; }

/* Admin Tabs */
.tabs { display: flex; gap: 0.25rem; margin-bottom: 2rem; border-bottom: 1px solid rgba(255,255,255,0.1); }
.tab {
  text-decoration: none;
  padding: 0.75rem 1.25rem;
  border-bottom: 2px solid transparent;
  color: rgba(255,255,255,0.5);
  font-weight: 500;
  font-size: 0.9rem;
  transition: color 0.2s, border-color 0.2s;
}
.tab:hover { color: #fff; border-bottom-color: rgba(255,255,255,0.3); }
.tab-section { margin-bottom: 3rem; }
.tab-section h2 { font-size: 1.2rem; margin-bottom: 1rem; }

/* Matrix */
.matrix th, .matrix td { text-align: center; }
.muted { color: rgba(255,255,255,0.4); }

/* Responsive */
@media (max-width: 600px) {
  .site-header { flex-direction: column; gap: 0.5rem; }
  nav { flex-wrap: wrap; justify-content: center; }
  .login-card { margin: 3rem 1rem; }
  .main { padding: 1rem; }
}

/* Form rows (side-by-side) */
.form-row {
  display: flex;
  gap: 1rem;
}
.form-row .form-group { flex: 1; }
@media (max-width: 500px) {
  .form-row { flex-direction: column; gap: 0; }
}
