:root {
  --bg-top: #0d1b3d;
  --bg-mid: #13315c;
  --bg-bottom: #eef3fb;
  --surface: #ffffff;
  --surface-alt: #f6f9ff;
  --text-main: #0d2340;
  --text-muted: #5f6f86;
  --brand: #1f67d2;
  --brand-strong: #0f4fad;
  --border: #d9e3f3;
  --shadow: 0 20px 50px rgba(11, 41, 87, 0.18);
  --radius-lg: 18px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text-main);
  background: linear-gradient(145deg, var(--bg-top), var(--bg-mid) 45%, var(--bg-bottom));
  min-height: 100vh;
}

.auth-page,
.portal-page {
  display: flex;
  flex-direction: column;
}

.auth-shell {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.auth-card {
  width: min(460px, 100%);
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 30px;
  animation: riseIn 350ms ease;
}

.auth-badge {
  margin: 0;
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #e9f1ff;
  color: #1f4f9b;
}

h1 {
  margin: 14px 0 6px;
  font-size: clamp(1.5rem, 1.1rem + 1.3vw, 2rem);
}

.auth-subtitle,
.header-subtitle {
  margin-top: 0;
  color: var(--text-muted);
}

.auth-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

label {
  font-size: 0.9rem;
  font-weight: 700;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  border: 1px solid #c7d5ee;
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

input[type="text"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(31, 103, 210, 0.16);
}

.remember-row {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-top: 2px;
  color: var(--text-muted);
  font-weight: 500;
}

.error-message {
  min-height: 22px;
  margin: 0;
  color: #b32424;
  font-size: 0.9rem;
}

.auth-hint {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: transform 170ms ease, box-shadow 170ms ease, background-color 170ms ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(180deg, #2c7dff, #1f67d2);
  color: #fff;
  box-shadow: 0 10px 22px rgba(31, 103, 210, 0.26);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #2f84ff, #1d5fc2);
}

.btn-secondary {
  background: #f2f6fc;
  color: var(--text-main);
  border: 1px solid var(--border);
}

.btn-block {
  width: 100%;
  margin-top: 2px;
}

.portal-header,
.portal-main {
  width: min(1200px, 100% - 32px);
  margin: 0 auto;
}

.portal-header {
  margin-top: 22px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
  animation: riseIn 350ms ease;
}

.header-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
  color: #5e7a9e;
  font-weight: 800;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 7px 10px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.profile-name,
.profile-role {
  margin: 0;
  line-height: 1.2;
}

.profile-name {
  font-weight: 700;
}

.profile-role {
  color: var(--text-muted);
  font-size: 0.84rem;
}

.portal-main {
  margin-top: 18px;
  margin-bottom: 20px;
}

.stats-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
}

.stat-item {
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: 0 10px 20px rgba(12, 41, 87, 0.1);
}

.stat-label {
  margin: 0;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.86rem;
}

.stat-value {
  margin: 8px 0 0;
  font-size: 1.35rem;
  font-weight: 800;
}

.cards-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.app-card {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: grid;
  gap: 10px;
  box-shadow: 0 10px 24px rgba(13, 40, 84, 0.12);
  transform: translateY(0);
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.app-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 32px rgba(13, 40, 84, 0.2);
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  background: #e9f2ff;
}

.app-card h2 {
  margin: 0;
  font-size: 1.04rem;
}

.app-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  min-height: 40px;
}

.secondary-grid {
  margin-top: 14px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.panel {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: 0 10px 24px rgba(13, 40, 84, 0.1);
}

.panel h3 {
  margin: 0 0 10px;
}

.panel ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text-muted);
  display: grid;
  gap: 8px;
}

.panel a {
  color: var(--brand-strong);
  text-decoration: none;
}

.panel a:hover {
  text-decoration: underline;
}

.site-footer {
  text-align: center;
  color: #dbe6fb;
  padding: 14px 10px 18px;
  font-size: 0.88rem;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .stats-panel {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}

@media (max-width: 640px) {
  .portal-header,
  .portal-main {
    width: min(1200px, 100% - 20px);
  }

  .auth-card {
    padding: 22px;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .profile-chip {
    flex: 1;
  }

  .stats-panel {
    grid-template-columns: 1fr;
  }
}
