:root {
  color-scheme: light;
  --primary: #004785;
  --primary-hover: #003666;
  --primary-light: #eff6ff;
  --primary-soft: rgba(0, 71, 133, 0.07);
  --primary-glow: rgba(0, 71, 133, 0.16);
  --ink: #0f172a;
  --ink-secondary: #334155;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-hover: #93c5fd;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --surface-alt: #f1f5f9;
  --error: #b91c1c;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 20px 35px -8px rgba(0, 71, 133, 0.10), 0 8px 16px -4px rgba(15, 23, 42, 0.04);
  --shadow-card-hover: 0 22px 42px -10px rgba(0, 71, 133, 0.14), 0 10px 20px -6px rgba(15, 23, 42, 0.04);
  font-family: 'Plus Jakarta Sans', Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: #f8fafc;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background-color: #f8fafc;
  background-image:
    radial-gradient(circle at 15% 10%, rgba(0, 71, 133, 0.04) 0%, transparent 42%),
    radial-gradient(circle at 85% 85%, rgba(0, 71, 133, 0.035) 0%, transparent 45%),
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(203, 213, 225, 0.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(203, 213, 225, 0.35) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ==========================================================================
   Simple Header
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.03);
}

.site-header-inner {
  display: flex;
  width: min(1180px, calc(100% - 48px));
  min-height: 84px;
  margin-inline: auto;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  transition: opacity 160ms ease;
}

.brand:hover {
  opacity: 0.9;
}

.header-logo {
  height: 52px;
  width: auto;
  max-width: 260px;
  object-fit: contain;
  display: block;
}

.header-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 9999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-secondary);
  letter-spacing: 0.01em;
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Content Area (Homepage)
   ========================================================================== */

.content {
  flex: 1;
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 60px 0 80px;
}

.portal-header {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 48px;
}

.portal-title {
  margin: 0 0 12px;
  font-size: clamp(2rem, 3.8vw, 2.75rem);
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.portal-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.portal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 220px;
  padding: 32px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: #ffffff;
  box-shadow: var(--shadow-md);
  text-decoration: none;
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1),
              border-color 220ms ease,
              box-shadow 220ms ease;
}

.portal-card:hover {
  transform: translateY(-5px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-card-hover);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.icon-box {
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(0, 71, 133, 0.12);
  border-radius: 14px;
  color: var(--primary);
  background: var(--primary-light);
  transition: transform 220ms ease, background-color 220ms ease;
}

.icon-box svg {
  width: 26px;
  height: 26px;
}

.portal-card:hover .icon-box {
  transform: scale(1.06);
  background: rgba(0, 71, 133, 0.12);
}

.portal-card h2 {
  margin: 32px 0 16px;
  font-size: clamp(1.25rem, 1.8vw, 1.55rem);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.card-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  font-size: 0.95rem;
  font-weight: 700;
  transition: gap 180ms ease, color 180ms ease;
}

.portal-card:hover .card-action {
  gap: 12px;
  color: var(--primary-hover);
}

/* ==========================================================================
   Login Page
   ========================================================================== */

.login-content {
  flex: 1;
  display: grid;
  width: min(1080px, calc(100% - 48px));
  margin: 0 auto;
  padding: 60px 0 80px;
  grid-template-columns: minmax(0, 1.05fr) minmax(380px, 0.95fr);
  gap: clamp(40px, 7vw, 96px);
  align-items: center;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
  color: var(--primary);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  transition: gap 160ms ease, color 160ms ease;
}

.back-link:hover {
  gap: 12px;
  color: var(--primary-hover);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-intro h1 {
  margin: 0 0 16px;
  font-size: clamp(2.2rem, 4.2vw, 3.4rem);
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.login-copy {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
  max-width: 480px;
}

.login-panel {
  padding: clamp(30px, 4vw, 44px);
  border: 1px solid var(--border);
  border-radius: 24px;
  background: #ffffff;
  box-shadow: var(--shadow-lg);
}

.login-panel h2 {
  margin: 0 0 6px;
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.025em;
}

.panel-note {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
}

.field label {
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--ink-secondary);
}

.field input {
  width: 100%;
  min-height: 50px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
  color: var(--ink);
  background: var(--surface-subtle);
  font-size: 0.95rem;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.field input:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input-wrap input {
  padding-right: 48px;
}

.password-toggle-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #94a3b8;
  border-radius: 8px;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease;
}

.password-toggle-btn:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.password-toggle-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.submit-button {
  width: 100%;
  min-height: 52px;
  margin-top: 8px;
  border: 0;
  border-radius: 12px;
  color: #ffffff;
  background: var(--primary);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 71, 133, 0.28);
  transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.submit-button:hover {
  background: var(--primary-hover);
  box-shadow: 0 6px 20px rgba(0, 71, 133, 0.36);
  transform: translateY(-1px);
}

.submit-button:active {
  transform: translateY(1px);
}

/* ==========================================================================
   Smart Centered Alert Popup Modal
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.modal-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  position: relative;
  width: min(420px, 100%);
  background: #ffffff;
  border-radius: 22px;
  padding: 36px 30px 30px;
  text-align: center;
  box-shadow:
    0 25px 60px -15px rgba(15, 23, 42, 0.28),
    0 0 0 1px rgba(226, 232, 240, 0.9);
  transform: scale(0.92) translateY(10px);
  opacity: 0;
  transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1), opacity 220ms ease;
}

.modal-backdrop.is-open .modal-dialog {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.modal-icon-wrap {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: #fef2f2;
  border: 1px solid #fee2e2;
  color: #dc2626;
  display: grid;
  place-items: center;
}

.modal-icon-wrap svg {
  width: 28px;
  height: 28px;
}

.modal-title {
  margin: 0 0 8px;
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.025em;
}

.modal-message {
  margin: 0 0 24px;
  font-size: 0.95rem;
  color: #64748b;
  line-height: 1.55;
}

.modal-button {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: #ffffff;
  font-size: 0.96rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 71, 133, 0.25);
  transition: background-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.modal-button:hover {
  background: var(--primary-hover);
  box-shadow: 0 6px 20px rgba(0, 71, 133, 0.35);
  transform: translateY(-1px);
}

.modal-button:active {
  transform: translateY(1px);
}

/* ==========================================================================
   Simple Footer
   ========================================================================== */

.site-footer {
  margin-top: auto;
  background: #ffffff;
  border-top: 1px solid var(--border);
  min-height: 76px;
  display: flex;
  align-items: center;
}

.footer-content {
  display: flex;
  width: min(1180px, calc(100% - 48px));
  margin-inline: auto;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--muted);
  font-size: 0.88rem;
}

.footer-content p {
  margin: 0;
}

.footer-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #94a3b8;
  font-size: 0.84rem;
}

.footer-dot {
  opacity: 0.6;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 820px) {
  .site-header-inner,
  .content,
  .login-content,
  .footer-content {
    width: min(100% - 32px, 640px);
  }

  .site-header-inner {
    min-height: 72px;
  }

  .header-logo {
    height: 42px;
  }

  .portal-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .portal-card {
    min-height: 190px;
    padding: 26px;
  }

  .login-content {
    padding: 40px 0 60px;
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .footer-content {
    justify-content: center;
    text-align: center;
    padding: 16px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
