* {
  box-sizing: border-box;
}

:root {
  --bg: #020617;
  --bg-elevated: #020617;
  --bg-card: #020617;
  --border: #1f2937;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.15);
  --text: #e5e7eb;
  --muted: #9ca3af;
  --danger: #f97373;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #0f172a 0, #020617 45%, #020617 100%);
  color: var(--text);
}

/* Login page */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: rgba(15, 23, 42, 0.95);
  border-radius: 0.9rem;
  padding: 2rem 2rem 1.5rem 2rem;
  box-shadow: 0 22px 45px rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(30, 64, 175, 0.9);
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.auth-subtitle {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.field {
  margin-bottom: 0.9rem;
}

.field label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
  display: block;
}

.field input {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 0.45rem;
  border: 1px solid #1f2937;
  background: #020617;
  color: var(--text);
  font-size: 0.9rem;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

.button {
  width: 100%;
  padding: 0.65rem;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #38bdf8, #22c55e);
  color: #020617;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  margin-top: 0.3rem;
}

.button:hover {
  filter: brightness(1.05);
}

.auth-brand {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.error-message {
  display: none;
  color: var(--danger);
  font-size: 0.8rem;
  margin-bottom: 0.4rem;
}

/* Layout dashboard */

.app-shell {
  display: flex;
  min-height: 100vh;
  background: radial-gradient(circle at top left, #0b1120 0, #020617 45%, #020617 100%);
}

.sidebar {
  width: 220px;
  padding: 1.2rem 1rem;
  background: #020617;
  border-right: 1px solid var(--border);
}

.sidebar-logo {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 1.4rem;
}

.sidebar-logo span {
  color: var(--accent);
}

.sidebar-nav a {
  display: block;
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.25rem;
  border-radius: 0.45rem;
  font-size: 0.88rem;
  color: var(--muted);
  text-decoration: none;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(15, 23, 42, 0.95);
  color: var(--text);
}

.sidebar-footer {
  margin-top: 2rem;
  font-size: 0.7rem;
  color: var(--muted);
}

/* Main content */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  background: linear-gradient(to right, rgba(15,23,42,0.95), rgba(15,23,42,0.8));
}

.topbar-title {
  font-size: 0.95rem;
  font-weight: 500;
}

.topbar-sub {
  font-size: 0.8rem;
  color: var(--muted);
}

.topbar-user {
  font-size: 0.8rem;
  color: var(--muted);
}

.page {
  padding: 1.5rem;
}

.page-title {
  font-size: 1.2rem;
  margin-bottom: 0.4rem;
}

.page-subtitle {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1.3rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.card {
  background: rgba(15, 23, 42, 0.95);
  border-radius: 0.8rem;
  padding: 1rem;
  border: 1px solid rgba(15, 118, 110, 0.5);
}

.card-title {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.card-value {
  font-size: 1.4rem;
  font-weight: 600;
}

/* Tables */

.table-wrapper {
  margin-top: 1.2rem;
  border-radius: 0.8rem;
  border: 1px solid var(--border);
  overflow: hidden;
  background: rgba(15, 23, 42, 0.95);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

thead {
  background: rgba(15, 23, 42, 0.9);
}

th, td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid rgba(30, 64, 175, 0.45);
  text-align: left;
}

tbody tr:hover {
  background: rgba(15, 23, 42, 0.8);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-size: 0.7rem;
  border: 1px solid var(--border);
}

.tag.active {
  border-color: #22c55e;
  color: #bbf7d0;
}

.tag.expired {
  border-color: #f97373;
  color: #fecaca;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.5);
  font-size: 0.7rem;
  color: var(--muted);
}

/* Simple form layout for modules/users pages */

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.toolbar form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.toolbar input,
.toolbar select {
  padding: 0.4rem 0.6rem;
  border-radius: 0.4rem;
  border: 1px solid var(--border);
  background: #020617;
  color: var(--text);
  font-size: 0.8rem;
}

.btn-secondary {
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #020617;
  color: var(--text);
  font-size: 0.78rem;
  cursor: pointer;
}

.btn-secondary:hover {
  border-color: var(--accent);
}