:root {
  --primary: #0d4f8b;
  --primary-dark: #0a3d6b;
  --accent: #00a8e8;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --sidebar: #0f2744;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(15, 39, 68, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "DM Sans", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

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

.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar);
  color: #e2e8f0;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding-bottom: 1rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand-link {
  display: block;
  text-decoration: none;
  text-align: center;
}

.sidebar-logo {
  width: 100%;
  max-width: 180px;
  height: auto;
  display: block;
  margin: 0 auto;
  object-fit: contain;
}

.sidebar-slogan {
  margin: -0.5rem 0 0;
  padding: 0 0.25rem;
  font-size: 0.68rem;
  line-height: 1.35;
  font-weight: 500;
  color: rgba(203, 213, 225, 0.95);
  text-align: center;
}

.sidebar-badge {
  display: block;
  margin-top: 0.65rem;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
}

.sidebar-user {
  margin-top: auto;
  padding-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: #94a3b8;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 1rem;
}

.sidebar nav { margin-top: 1.25rem; flex: 1; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #cbd5e1;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  margin-bottom: 0.25rem;
  text-decoration: none;
}
.sidebar nav a:hover,
.sidebar nav a.active {
  background: rgba(255,255,255,0.08);
  color: #fff;
  text-decoration: none;
}

.main { padding: 1.5rem 2rem; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.topbar h1 { margin: 0; font-size: 1.5rem; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.stat strong { display: block; font-size: 1.75rem; color: var(--primary); }
.stat span { color: var(--muted); font-size: 0.85rem; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th, td {
  text-align: left;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
}
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:hover td { background: #f8fafc; }

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-muted { background: #e2e8f0; color: #475569; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.8rem; }

.form-grid {
  display: grid;
  gap: 1rem;
  max-width: 640px;
}
label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}
input, select, textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}
textarea { min-height: 90px; resize: vertical; }

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}
.alert-success { background: #d1fae5; color: #065f46; }
.alert-error { background: #fee2e2; color: #991b1b; }

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

.login-page {
  min-height: 100vh;
  background: linear-gradient(145deg, #020617 0%, var(--sidebar) 42%, var(--primary) 100%);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem;
  gap: 2rem;
  align-items: center;
}

.login-brand-panel {
  color: #f1f5f9;
  padding: 1rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.login-logo {
  width: 100%;
  max-width: 520px;
  height: auto;
  display: block;
  margin: 0 auto -3.25rem;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.35));
}

.login-slogan {
  text-align: center;
  margin: -0.25rem auto 0.5rem;
  max-width: 420px;
  font-size: 0.95rem;
  color: #cbd5e1;
  line-height: 1.35;
}

.login-features {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 380px;
}

.login-features li {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  font-size: 0.92rem;
  color: #e2e8f0;
  text-align: left;
}

.login-features i {
  color: var(--accent);
  font-size: 1.1rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
  justify-self: center;
  margin: 0 auto;
  background: var(--card);
  padding: 2.25rem 2rem;
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(15, 39, 68, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-align: center;
}

.login-card-head {
  text-align: center;
}

.login-card-head h1 {
  margin: 0 0 0.35rem;
  font-size: 1.45rem;
  color: var(--text);
}

.login-card-head p {
  color: var(--muted);
  margin: 0 0 1.5rem;
  font-size: 0.9rem;
}

.login-form {
  max-width: none;
  text-align: left;
}

.input-wrap label {
  color: var(--text);
  text-align: left;
}

.input-icon {
  position: relative;
}

.input-icon i {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 1rem;
  pointer-events: none;
}

.input-icon input {
  padding-left: 2.5rem;
}

.input-icon input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 168, 232, 0.15);
}

.btn-login {
  width: 100%;
  justify-content: center;
  padding: 0.75rem 1rem;
  margin-top: 0.25rem;
  font-size: 0.95rem;
}

.login-footer-note {
  margin: 1.25rem 0 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
}

.alert-error {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-align: center;
}

.mono { font-family: ui-monospace, monospace; font-size: 0.85rem; }
.text-muted { color: var(--muted); font-size: 0.85rem; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { padding: 1rem; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 1rem; }
  .sidebar-user { margin-top: 1rem; }
}

@media (min-width: 861px) {
  .login-card {
    justify-self: end;
    margin: 0;
  }
}

@media (max-width: 860px) {
  .login-shell {
    grid-template-columns: 1fr;
    padding: 1.5rem 1rem;
    justify-items: center;
  }
  .login-brand-panel {
    padding: 0.5rem 0 0;
    text-align: center;
  }
  .login-logo {
    max-width: min(520px, 92vw);
  }
  .login-features {
    max-width: 320px;
    margin: 0 auto;
  }
  .login-card {
    justify-self: center;
    max-width: 100%;
  }
}
