:root {
  --navy: #12385f;
  --navy2: #0a2742;
  --teal: #0f7c78;
  --amber: #d99b2b;
  --bg: #f4f7fa;
  --card: #fff;
  --text: #17212b;
  --muted: #657484;
  --line: #dce4eb;
  --ok: #14804a;
  --danger: #c73838;
  --shadow: 0 10px 30px rgba(18, 56, 95, .08);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }
button, input, select, textarea { font: inherit; }
.hidden { display: none !important; }

/* Authentication */
.login { position: relative; min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; background: #fff; }
.login-institution-header { position: absolute; inset: 0 0 auto; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 28px 36px; pointer-events: none; }
.login-institution-header span { max-width: calc(55% - 36px); color: #fff; font-size: clamp(18px, 1.7vw, 27px); line-height: 1.2; font-weight: 800; letter-spacing: -.02em; }
.login-institution-header img { width: 88px; height: 88px; object-fit: contain; border-radius: 0; background: transparent; padding: 0; filter: drop-shadow(0 7px 12px rgba(7, 23, 39, .14)); }
.login-brand { padding: max(128px, 8vw) 8vw 8vw; background: linear-gradient(145deg, var(--navy2), var(--navy)); color: #fff; display: flex; flex-direction: column; justify-content: center; }
.logo { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 22px; }
.logo-image img { width: 48px; height: 48px; object-fit: contain; border-radius: 0; background: transparent; padding: 0; flex: 0 0 auto; }
.login-brand .logo-image img { width: 72px; height: 72px; }
.login-brand h1 { font-size: 48px; line-height: 1.08; max-width: 650px; margin: 0 0 18px; }
.login-brand p { font-size: 17px; line-height: 1.65; max-width: 620px; color: #d9e6f0; }
.login-form { padding: 8vw; display: flex; justify-content: center; flex-direction: column; }
.login-form h2 { font-size: 32px; margin: 0 0 8px; }
.login-form form { width: 100%; max-width: 440px; }

/* Forms and controls */
.field { margin: 18px 0; }
.field label { display: block; font-weight: 650; margin: 0 0 7px; }
.field input, .field select, .field textarea { width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); }
.field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid #cce9e7; border-color: var(--teal); }
button { border: 0; border-radius: 8px; padding: 12px 16px; background: var(--navy); color: #fff; font-weight: 700; cursor: pointer; min-height: 44px; }
button:hover { filter: brightness(1.07); }
button:focus-visible, a:focus-visible { outline: 3px solid #8bd3ce; outline-offset: 2px; }
button.secondary { background: #fff; color: var(--navy); border: 1px solid var(--line); }
button.good { background: var(--ok); }
button.bad { background: var(--danger); }
button:disabled { opacity: .55; cursor: not-allowed; }
.wide { width: 100%; margin-top: 8px; }
.button { display: inline-flex; align-items: center; text-decoration: none; background: var(--teal); color: #fff; border-radius: 9px; padding: 10px 14px; font-weight: 700; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Application shell */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--navy2); color: #fff; padding: 24px 18px; display: flex; flex-direction: column; overflow: hidden; }
.side .logo { padding: 2px 8px; }
.side nav { overflow-y: auto; min-height: 0; margin-top: 24px; display: grid; gap: 6px; }
.side nav button, .side nav .nav-link { width: 100%; min-height: 42px; display: flex; align-items: center; text-align: left; padding: 10px 12px; border-radius: 8px; background: transparent; color: #cbd9e5; text-decoration: none; font-weight: 700; }
.side nav button:hover, .side nav button.active, .side nav .nav-link:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.side-footer { margin-top: auto; padding: 18px 8px 0; color: #a9bdce; font-size: 12px; }
.recruitment-link { background: var(--teal) !important; color: #fff !important; font-weight: 800 !important; box-shadow: 0 8px 18px #001c2960; }
.main { min-width: 0; padding: 30px; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 24px; }
.top h1 { margin: 0 0 5px; font-size: 28px; color: var(--navy2); }
.top p { margin: 0; }
.user { display: flex; align-items: center; gap: 10px; }
.profile-trigger { display: flex; align-items: center; gap: 10px; background: transparent; color: var(--text); border: 1px solid transparent; padding: 6px 10px; text-align: left; }
.profile-trigger:hover, .profile-trigger:focus { background: #eef6fb; border-color: var(--line); box-shadow: none; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--teal); color: #fff; font-weight: 800; }
.mobile-nav { display: none; }

/* Content */
.page { display: none; }
.page.active { display: block; }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px; }
.span3 { grid-column: span 3; }
.span4 { grid-column: span 4; }
.span5 { grid-column: span 5; }
.span6 { grid-column: span 6; }
.span7 { grid-column: span 7; }
.span8 { grid-column: span 8; }
.span12 { grid-column: span 12; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card h2 { margin: 0 0 12px; color: var(--navy2); font-size: 20px; }
.card h3 { color: var(--navy2); }
.card.kpi { display: grid; gap: 6px; }
.kpi b { font-size: 30px; color: var(--navy); }
.muted { color: var(--muted); }
.notice { margin: 14px 0; padding: 12px 14px; border-radius: 8px; background: #eaf6f5; color: #075e59; border: 1px solid #b8e1dd; }
.notice.error { background: #fff0f0; color: #9b2222; border-color: #efc2c2; }
.bad-text { color: var(--danger); font-size: 12px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.inner { box-shadow: none; margin: 8px 0; }
.badge { display: inline-block; border-radius: 999px; padding: 4px 9px; background: #e9eef3; color: #3b4a58; font-size: 12px; font-weight: 750; }
.badge.Approved, .badge.Active { background: #e5f5ec; color: #0e6c3c; }
.badge.REVIEW, .badge.Pending { background: #fff2d9; color: #875a00; }
.badge.HOLD, .badge.Rejected { background: #fde7e7; color: #9b2222; }
.table { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.profile { display: grid; grid-template-columns: minmax(150px, .55fr) 1fr; gap: 0 18px; }
.profile dt, .profile dd { padding: 10px 0; border-bottom: 1px solid var(--line); }
.profile dt { color: var(--muted); font-weight: 650; }
.profile dd { margin: 0; font-weight: 650; }
.toggle { display: flex; align-items: center; gap: 8px; margin: 14px 0; font-weight: 700; }
.toggle input { width: 20px; height: 20px; }
.site-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; border-top: 1px solid var(--line); padding: 12px 0; }

/* Mandatory first-login password change */
.modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px; overflow-y: auto; background: rgba(7, 23, 39, .88); }
.modal-card { width: min(460px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; margin: auto; padding: 28px; border-radius: 18px; background: #fff; box-shadow: 0 24px 70px rgba(0, 0, 0, .28); }
.modal-card h2 { margin: 0 0 8px; text-align: center; color: var(--navy2); }
.modal-card > p { text-align: center; }
.modal-logo { display: block; width: 72px; height: 72px; max-width: 72px; object-fit: contain; margin: 0 auto 12px; border-radius: 10px; background: #fff; }

@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-institution-header { padding: 20px 24px; }
  .login-institution-header span { max-width: calc(100% - 100px); font-size: 21px; }
  .login-institution-header img { width: 68px; height: 68px; }
  .login-brand { padding: 118px 24px 30px; }
  .login-brand h1 { font-size: 34px; margin: 26px 0 14px; }
  .login-form { padding: 36px 24px; }
  .shell { display: block; padding-bottom: 72px; }
  .side { height: auto; position: static; padding: 14px; }
  .side nav, .side-footer { display: none; }
  .main { padding: 20px 14px; }
  .span3, .span4, .span5, .span6, .span7, .span8, .span12 { grid-column: span 12; }
  .top { display: block; }
  .user { margin-top: 16px; }
  .mobile-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; justify-content: space-around; padding: 7px; background: #fff; border-top: 1px solid var(--line); }
  .mobile-nav button { background: transparent; color: var(--navy); padding: 7px; font-size: 11px; }
  .mobile-nav a { color: var(--navy); text-decoration: none; font-size: 11px; font-weight: 700; padding: 14px 7px; }
  .profile { grid-template-columns: 1fr; }
  .profile dd { margin-bottom: 8px; }
}

@media (max-width: 520px) {
  .login-institution-header { gap: 14px; padding: 16px 18px; }
  .login-institution-header span { max-width: calc(100% - 76px); font-size: 18px; }
  .login-institution-header img { width: 58px; height: 58px; border-radius: 9px; }
  .login-brand { padding: 96px 18px 24px; }
  .login-brand .logo-image img { width: 56px; height: 56px; }
  .login-brand h1 { font-size: 28px; }
  .login-form { padding: 28px 18px; }
  .modal { padding: 12px; align-items: start; }
  .modal-card { width: 100%; max-height: calc(100vh - 24px); margin-top: 12px; padding: 22px 18px; }
  .modal-logo { width: 60px; height: 60px; max-width: 60px; }
}
