:root {
  --brand: #102a43;
  --accent: #1d4ed8;
  --accent-soft: #eff6ff;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #152335;
  --muted: #64748b;
  --line: #dce4ee;
  --success: #0f8a56;
  --warning: #c47b08;
  --danger: #c93434;
  --radius: 16px;
  --shadow: 0 16px 44px rgba(30, 55, 82, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
.hidden { display: none !important; }
.container { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.muted { color: var(--muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }

.topbar {
  height: 72px;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(14px);
}
.topbar-inner { display: flex; align-items: center; gap: 20px; width: 100%; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 850; letter-spacing: -.02em; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 28%, transparent);
  font-weight: 900;
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.top-link { font-size: .88rem; color: var(--muted); padding: 9px 11px; border-radius: 9px; }
.top-link:hover { color: var(--text); background: var(--surface-2); }
.secure-chip { display: inline-flex; align-items: center; gap: 7px; color: var(--success); font-size: .78rem; font-weight: 750; }
.secure-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 5px rgba(15,138,86,.10); }

.hero {
  padding: 76px 0 58px;
  background:
    radial-gradient(circle at 15% 10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 34%),
    linear-gradient(155deg, #fff 0%, #f5f8fd 55%, #eef4fb 100%);
  border-bottom: 1px solid var(--line);
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 54px; align-items: center; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .13em; font-size: .72rem; font-weight: 850; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 4.2rem); line-height: 1.06; letter-spacing: -.045em; margin: 15px 0 18px; max-width: 780px; }
.hero p { color: var(--muted); font-size: 1.06rem; line-height: 1.75; max-width: 690px; margin: 0; }
.hero-points { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 26px; }
.hero-point { display: flex; align-items: center; gap: 8px; font-size: .86rem; font-weight: 700; }
.check { width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--success); font-size: .72rem; }
.hero-card { background: rgba(255,255,255,.88); border: 1px solid rgba(255,255,255,.8); box-shadow: var(--shadow); border-radius: 24px; padding: 26px; }
.hero-card-top { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.hero-card-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 1.4rem; }
.hero-stat { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; padding: 15px 0; border-top: 1px solid var(--line); }
.hero-stat strong { font-size: 1.35rem; }

.section { padding: 54px 0; }
.section-head { display: flex; justify-content: space-between; gap: 20px; align-items: end; margin-bottom: 22px; }
.section-head h2 { margin: 4px 0 0; font-size: 1.55rem; letter-spacing: -.02em; }
.institution-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.institution-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; gap: 15px; align-items: center; transition: .2s ease; min-height: 108px; }
.institution-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: var(--shadow); }
.institution-logo { width: 66px; height: 66px; flex: 0 0 66px; border-radius: 15px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; font-weight: 850; color: var(--accent); }
.institution-logo img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.institution-card h3 { margin: 0 0 6px; font-size: .98rem; line-height: 1.35; }
.institution-card p { margin: 0; color: var(--muted); font-size: .78rem; }
.arrow { margin-left: auto; color: var(--muted); }

.institution-hero { padding: 32px 0; background: linear-gradient(125deg, var(--brand), color-mix(in srgb, var(--brand) 76%, #000)); color: white; }
.institution-head { display: flex; align-items: center; gap: 18px; }
.institution-head .institution-logo { width: 82px; height: 82px; flex-basis: 82px; background: #fff; }
.institution-head h1 { margin: 0 0 7px; font-size: clamp(1.35rem, 3vw, 2.1rem); }
.institution-head p { margin: 0; color: rgba(255,255,255,.7); }
.institution-badge { margin-left: auto; display: flex; align-items: center; gap: 9px; padding: 10px 14px; border-radius: 10px; border: 1px solid rgba(255,255,255,.22); color: rgba(255,255,255,.9); font-size: .8rem; }

.portal-area { padding: 42px 0 64px; }
.portal-grid { display: grid; grid-template-columns: minmax(290px, .72fr) minmax(0, 1.28fr); gap: 24px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 30px rgba(30,55,82,.05); }
.panel-head { padding: 20px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.panel-head h2, .panel-head h3 { margin: 0; font-size: 1rem; }
.panel-body { padding: 22px; }
.switcher { display: grid; grid-template-columns: 1fr; gap: 6px; background: #eaf0f7; padding: 5px; border-radius: 12px; margin-bottom: 20px; }
.switcher a { text-align: center; padding: 11px; border-radius: 9px; color: var(--muted); font-size: .82rem; font-weight: 750; }
.switcher a.active { background: #fff; color: var(--accent); box-shadow: 0 3px 12px rgba(30,55,82,.08); }

.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 7px; font-size: .77rem; font-weight: 780; color: #3f5268; }
.input, .select, .textarea { width: 100%; border: 1px solid #cfd9e5; background: #fff; color: var(--text); border-radius: 10px; padding: 12px 13px; outline: none; transition: .15s; }
.textarea { min-height: 105px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent); }
.help { color: var(--muted); font-size: .72rem; line-height: 1.5; margin-top: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row.three { grid-template-columns: repeat(3, 1fr); }
.button { border: 0; border-radius: 10px; min-height: 43px; padding: 0 17px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 780; font-size: .84rem; transition: .18s; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--accent); box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 22%, transparent); }
.button-dark { color: #fff; background: var(--brand); }
.button-light { color: var(--text); background: #eef3f8; border: 1px solid var(--line); }
.button-danger { color: #fff; background: var(--danger); }
.button-success { color: #fff; background: var(--success); }
.button-sm { min-height: 34px; padding: 0 11px; font-size: .74rem; }
.button-block { width: 100%; }
.button-row { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.mode-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 18px; }
.mode-tab { border: 1px solid var(--line); color: var(--muted); background: var(--surface-2); border-radius: 9px; padding: 9px 5px; font-size: .72rem; font-weight: 760; }
.mode-tab.active { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.radio-line { display: flex; gap: 18px; align-items: center; }
.radio-line label { display: flex; align-items: center; gap: 7px; font-size: .8rem; font-weight: 650; }

.alert { padding: 13px 15px; border-radius: 10px; margin-bottom: 16px; border: 1px solid; font-size: .82rem; line-height: 1.5; }
.alert-error { color: #962f2f; background: #fff3f3; border-color: #f2caca; }
.alert-success { color: #0a7146; background: #edfbf5; border-color: #bcead5; }
.alert-warning { color: #8a5808; background: #fff8e8; border-color: #efdaa7; }
.alert-info { color: #245898; background: #eff6ff; border-color: #c8dcf6; }

.empty-state { text-align: center; padding: 48px 22px; color: var(--muted); }
.empty-icon { width: 62px; height: 62px; border-radius: 18px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--surface-2); color: var(--accent); font-size: 1.6rem; }
.empty-state h3 { color: var(--text); margin: 0 0 8px; }
.empty-state p { margin: 0; font-size: .84rem; line-height: 1.6; }

.verification-result { border-top: 4px solid var(--success); }
.verified-line { display: flex; align-items: center; gap: 13px; padding: 18px; border-radius: 12px; background: #effaf5; margin-bottom: 18px; }
.verified-icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--success); color: white; font-weight: 900; }
.verified-line strong { display: block; color: var(--success); margin-bottom: 3px; }
.data-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.data-cell { background: #fff; padding: 14px 15px; min-height: 72px; }
.data-cell span { display: block; color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.data-cell strong { font-size: .88rem; overflow-wrap: anywhere; }

.footer { padding: 30px 0; border-top: 1px solid var(--line); color: var(--muted); background: #fff; font-size: .76rem; }
.footer-inner { display: flex; align-items: center; gap: 15px; }
.footer-links { margin-left: auto; display: flex; gap: 15px; }

/* Dashboard */
.dashboard { min-height: 100vh; background: #f3f6fa; }
.dash-shell { display: grid; grid-template-columns: 265px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: #0e2237; color: #dce7f2; padding: 22px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { padding: 0 7px 22px; color: #fff; }
.user-mini { padding: 15px 11px; margin-bottom: 18px; border: 1px solid rgba(255,255,255,.1); border-radius: 13px; background: rgba(255,255,255,.045); display: flex; align-items: center; gap: 11px; }
.avatar { width: 42px; height: 42px; border-radius: 12px; flex: 0 0 auto; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--accent), #40a9ff); font-weight: 850; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-mini strong { display: block; font-size: .8rem; line-height: 1.3; }
.user-mini span { color: #90a5ba; font-size: .68rem; }
.nav-label { color: #6f879f; text-transform: uppercase; letter-spacing: .11em; font-size: .61rem; font-weight: 850; padding: 10px 12px 7px; }
.side-nav { display: grid; gap: 4px; }
.side-link { display: flex; align-items: center; gap: 11px; color: #aebfd0; border-radius: 10px; padding: 11px 12px; font-size: .8rem; font-weight: 650; }
.side-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-link.active { background: color-mix(in srgb, var(--accent) 65%, transparent); color: #fff; }
.side-icon { width: 22px; text-align: center; font-size: .95rem; }
.sidebar-bottom { margin-top: 24px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.1); }
.dash-main { min-width: 0; }
.dash-top { height: 72px; padding: 0 28px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 20; }
.dash-top h1 { font-size: 1rem; margin: 0; }
.dash-top .muted { font-size: .72rem; }
.dash-top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.menu-button { display: none; width: 40px; height: 40px; border: 1px solid var(--line); background: #fff; border-radius: 10px; }
.dash-content { padding: 28px; max-width: 1440px; }
.welcome { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-radius: 18px; padding: 25px 27px; color: #fff; background: linear-gradient(120deg, var(--brand), color-mix(in srgb, var(--accent) 60%, var(--brand))); margin-bottom: 22px; overflow: hidden; position: relative; }
.welcome::after { content: ''; width: 220px; height: 220px; border: 38px solid rgba(255,255,255,.06); position: absolute; border-radius: 50%; right: -55px; top: -90px; }
.welcome h2 { margin: 0 0 7px; font-size: 1.45rem; }
.welcome p { margin: 0; color: rgba(255,255,255,.72); font-size: .82rem; }
.status-pill { padding: 8px 12px; border-radius: 999px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); font-size: .74rem; font-weight: 760; position: relative; z-index: 1; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.stat-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.stat-icon { width: 37px; height: 37px; border-radius: 10px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); }
.stat-card strong { font-size: 1.45rem; letter-spacing: -.03em; }
.stat-card p { margin: 4px 0 0; color: var(--muted); font-size: .71rem; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(280px, .7fr); gap: 18px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.card-head { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.card-head h2, .card-head h3 { margin: 0; font-size: .9rem; }
.card-head .button { margin-left: auto; }
.card-body { padding: 18px; }
.info-list { display: grid; }
.info-row { display: grid; grid-template-columns: minmax(145px, .65fr) minmax(0, 1.35fr); gap: 16px; padding: 12px 0; border-bottom: 1px solid #edf1f5; }
.info-row:last-child { border-bottom: 0; }
.info-row dt { color: var(--muted); font-size: .73rem; }
.info-row dd { margin: 0; font-size: .8rem; font-weight: 650; overflow-wrap: anywhere; }
.notice { padding: 14px 0; border-bottom: 1px solid #edf1f5; }
.notice:last-child { border-bottom: 0; }
.notice strong { display: block; margin-bottom: 5px; font-size: .8rem; }
.notice p { margin: 0; color: var(--muted); line-height: 1.55; font-size: .75rem; }
.notice time { display: block; margin-top: 7px; color: #94a3b8; font-size: .65rem; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 720px; }
.table th { background: #f7f9fc; color: #5d7188; text-align: left; padding: 11px 13px; border-bottom: 1px solid var(--line); font-size: .66rem; text-transform: uppercase; letter-spacing: .035em; }
.table td { padding: 12px 13px; border-bottom: 1px solid #edf1f5; font-size: .76rem; vertical-align: middle; }
.table tbody tr:hover { background: #fafcff; }
.table tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; padding: 5px 9px; font-size: .65rem; font-weight: 760; white-space: nowrap; }
.badge-success { color: #087849; background: #e9f9f1; }
.badge-warning { color: #96600a; background: #fff5dc; }
.badge-danger { color: #9e3030; background: #fff0f0; }
.badge-info { color: #245898; background: #ebf4ff; }
.badge-muted { color: #5d6c7d; background: #eef2f6; }
.semester-block { margin-bottom: 18px; }
.semester-title { display: flex; align-items: center; gap: 12px; padding: 13px 16px; background: #f7f9fc; border-bottom: 1px solid var(--line); }
.semester-title h3 { margin: 0; font-size: .82rem; }
.semester-title span { margin-left: auto; color: var(--muted); font-size: .7rem; }
.progress { height: 7px; border-radius: 999px; background: #e8eef5; overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #3ba4ff); }
.document-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.document-card { border: 1px solid var(--line); border-radius: 13px; padding: 16px; background: #fff; }
.document-icon { width: 43px; height: 43px; border-radius: 12px; display: grid; place-items: center; background: #fff3f3; color: var(--danger); font-weight: 850; margin-bottom: 14px; }
.document-card h3 { font-size: .82rem; margin: 0 0 7px; }
.document-card p { color: var(--muted); font-size: .69rem; margin: 3px 0; }
.document-card .button { margin-top: 12px; }
.institution-group-head { margin-top: 36px; margin-bottom: 16px; }
.institution-group-head:first-of-type { margin-top: 20px; }

/* Admin */
.admin .sidebar { background: #121c2a; }
.page-head { display: flex; align-items: end; gap: 18px; justify-content: space-between; margin-bottom: 20px; }
.page-head h2 { margin: 0 0 5px; font-size: 1.35rem; }
.page-head p { margin: 0; color: var(--muted); font-size: .77rem; }
.toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; padding: 15px; background: #fff; border: 1px solid var(--line); border-radius: 13px; margin-bottom: 16px; }
.toolbar .field { margin: 0; min-width: 180px; flex: 1; }
.toolbar .field.small { max-width: 190px; }
.actions { display: flex; align-items: center; gap: 6px; }
.action-link { width: 33px; height: 33px; border-radius: 8px; display: grid; place-items: center; background: #f0f4f8; border: 1px solid var(--line); font-size: .75rem; }
.action-link:hover { border-color: var(--accent); color: var(--accent); }
.form-section { padding: 20px; border-bottom: 1px solid var(--line); }
.form-section:last-child { border-bottom: 0; }
.form-section h3 { margin: 0 0 17px; font-size: .88rem; }
.profile-strip { display: flex; align-items: center; gap: 16px; }
.profile-strip .avatar { width: 58px; height: 58px; border-radius: 16px; }
.profile-strip h2 { margin: 0 0 4px; font-size: 1.15rem; }
.profile-strip p { margin: 0; color: var(--muted); font-size: .75rem; }
.danger-zone { border-color: #efcaca; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 20% 10%, #dceaff, transparent 34%), #f4f7fb; }
.login-card { width: min(440px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 30px; box-shadow: var(--shadow); }
.login-card .brand { margin-bottom: 28px; }
.login-card h1 { font-size: 1.5rem; margin: 0 0 7px; }
.login-card > p { color: var(--muted); line-height: 1.6; font-size: .8rem; margin: 0 0 22px; }

@media (max-width: 1050px) {
  .institution-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .document-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row.three { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
  .hero-grid, .portal-grid, .content-grid { grid-template-columns: 1fr; }
  .hero { padding-top: 48px; }
  .dash-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -290px; width: 265px; z-index: 50; transition: left .2s; }
  body.sidebar-open .sidebar { left: 0; box-shadow: 10px 0 30px rgba(0,0,0,.22); }
  body.sidebar-open::after { content: ''; position: fixed; inset: 0; background: rgba(6,19,31,.48); z-index: 40; }
  .menu-button { display: inline-grid; place-items: center; }
  .dash-content { padding: 20px; }
  .dash-top { padding: 0 18px; }
  .institution-badge { display: none; }
}
@media (max-width: 620px) {
  .container { width: min(100% - 22px, 1180px); }
  .topbar { height: 64px; }
  .secure-chip, .top-link.optional { display: none; }
  .hero h1 { font-size: 2.25rem; }
  .hero-card { padding: 20px; }
  .institution-grid, .stats-grid, .document-grid, .form-row, .form-row.three, .data-grid { grid-template-columns: 1fr; }
  .institution-card { min-height: 94px; padding: 15px; }
  .institution-logo { width: 58px; height: 58px; flex-basis: 58px; }
  .institution-head { align-items: flex-start; }
  .institution-head .institution-logo { width: 66px; height: 66px; flex-basis: 66px; }
  .panel-body, .card-body { padding: 16px; }
  .welcome { align-items: flex-start; flex-direction: column; padding: 21px; }
  .info-row { grid-template-columns: 1fr; gap: 5px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .footer-inner { align-items: flex-start; flex-direction: column; }
  .footer-links { margin-left: 0; }
}

@media print {
  .sidebar, .dash-top, .button, .footer, .topbar { display: none !important; }
  .dash-shell { display: block; }
  .dash-content { padding: 0; }
  body, .dashboard { background: #fff; }
  .card, .panel, .stat-card { box-shadow: none; break-inside: avoid; }
}
