@font-face {
  font-family: "Inter";
  src: url("assets/fonts/InterVariable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --navy-950: #07122a;
  --navy-900: #0a1f4a;
  --blue-600: #1f5fe0;
  --blue-500: #2f74f4;
  --white-100: #f7f9ff;
  --yellow-500: #f0c71a;
  --green-500: #24a357;
  --red-500: #d84a39;
  --border: rgba(255, 255, 255, 0.16);
  --panel: rgba(255, 255, 255, 0.05);
  --panel-soft: rgba(255, 255, 255, 0.03);
}

html {
  width: 100%;
  height: 100%;
  overflow-x: clip;
  overflow-y: auto;
  background-color: #050f21;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
}

html.login-gate-active {
  overflow: hidden;
  overscroll-behavior: none;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  color: var(--white-100);
  line-height: 1.5;
  background:
    radial-gradient(760px 340px at 20% -8%, #1d52bf 0%, transparent 60%),
    radial-gradient(850px 460px at 82% -18%, #13397f 0%, transparent 63%),
    linear-gradient(180deg, var(--navy-950) 0%, #081933 45%, #050f21 100%);
  background-attachment: fixed;
  background-color: #050f21;
  min-height: 100vh;
  width: 100%;
  margin: 0;
  padding: 0;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

body.login-active {
  min-height: 100dvh;
  overflow-x: clip;
  overflow-y: auto;
}

.container {
  width: min(1100px, 92%);
  margin-inline: auto;
}

.hidden {
  display: none !important;
}

.login-gate,
.upt-pioneer {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.login-gate {
  position: relative;
  z-index: 40;
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: none;
}

.login-gate::-webkit-scrollbar {
  width: 8px;
}

.login-gate::-webkit-scrollbar-track {
  background: transparent;
}

.login-gate::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.login-gate::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.upt-pioneer {
  --pioneer-navy-950: #030a19;
  --pioneer-navy-900: #07182f;
  --pioneer-navy-800: #0b2857;
  --pioneer-blue: #609eea;
  --pioneer-gold: #e5b84a;
  --pioneer-text: #f7f9fc;
  --pioneer-muted: #c8d5ea;
  --pioneer-portrait-duration: 2200ms;
  --pioneer-brand-duration: 600ms;
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding: clamp(1rem, 4vw, 3.5rem);
  overflow: hidden;
  overscroll-behavior: none;
  isolation: isolate;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(circle at 72% 44%, rgba(38, 96, 184, 0.16), transparent 35%),
    radial-gradient(circle at 14% 84%, rgba(18, 62, 126, 0.12), transparent 32%),
    linear-gradient(135deg, var(--pioneer-navy-950), var(--pioneer-navy-900) 54%, #08203f);
}

.upt-pioneer::before {
  display: none;
}

.upt-pioneer::after {
  display: none;
}

.upt-pioneer__card {
  position: relative;
  width: min(1380px, 100%);
  height: min(860px, calc(100dvh - clamp(2rem, 7vw, 6rem)));
  min-height: min(620px, calc(100dvh - 2rem));
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.upt-pioneer.is-portrait-phase .upt-pioneer__card {
  animation: uptPioneerPortrait var(--pioneer-portrait-duration) cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.upt-pioneer.is-portrait-phase .upt-pioneer__card.is-reading-paused {
  animation-play-state: paused;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.upt-pioneer__hold-hint {
  position: absolute;
  z-index: 3;
  bottom: 1.5rem;
  left: 50%;
  width: max-content;
  max-width: 90%;
  margin: 0;
  color: var(--pioneer-muted);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-align: center;
  pointer-events: none;
  transform: translateX(-50%);
}

.upt-pioneer__copy {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: clamp(0.25rem, 2.2vw, 2.5rem);
  width: min(34ch, 37%);
  display: grid;
  gap: 0.7rem;
  min-width: 0;
  padding: 0;
  border-left: 0;
  transform: translateY(-50%);
}

.upt-pioneer__copy::before {
  content: none;
}

.upt-pioneer__portrait {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 72%;
  width: min(1224px, 108.8vw, 119.68dvh);
  aspect-ratio: 4 / 5;
  height: auto;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transform: translate(-50%, -50%);
}

.upt-pioneer__portrait[data-pioneer-id="kirchhoff"] {
  top: calc(50% + 8dvh);
}

.upt-pioneer__portrait[data-pioneer-id="faraday"] {
  top: 50%;
}

.upt-pioneer__portrait[data-pioneer-id="ohm"] {
  top: calc(50% + 2dvh);
}

.upt-pioneer__portrait::after {
  display: none;
}

.upt-pioneer__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  background: transparent;
  filter: grayscale(0.12) saturate(0.78) brightness(1.02) contrast(1.16) drop-shadow(0 22px 38px rgba(0, 0, 0, 0.3));
  opacity: 0.94;
  -webkit-mask-image:
    linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.08) 7%, #000 25%, #000 68%, rgba(0, 0, 0, 0.05) 83%, transparent 100%),
    linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.18) 9%, #000 22%, #000 74%, rgba(0, 0, 0, 0.14) 88%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.08) 7%, #000 25%, #000 68%, rgba(0, 0, 0, 0.05) 83%, transparent 100%),
    linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.18) 9%, #000 22%, #000 74%, rgba(0, 0, 0, 0.14) 88%, transparent 100%);
  mask-composite: intersect;
}

.upt-pioneer__edge-filter { position: absolute; pointer-events: none; }

.upt-pioneer__portrait[data-pioneer-id="faraday"] .upt-pioneer__image,
.upt-pioneer__portrait[data-pioneer-id="ohm"] .upt-pioneer__image {
  position: absolute;
  top: 24%;
  left: 50%;
  width: 72%;
  height: auto;
  object-fit: contain;
  transform: translateX(-50%);
  filter: url(#uptPioneerCleanEdge) saturate(0.52) brightness(0.84) contrast(1.12);
  -webkit-mask-image:
    linear-gradient(to right, transparent 0%, #000 13%, #000 87%, transparent 100%),
    linear-gradient(to bottom, transparent 0%, #000 6%, #000 66%, transparent 96%);
  mask-image:
    linear-gradient(to right, transparent 0%, #000 13%, #000 87%, transparent 100%),
    linear-gradient(to bottom, transparent 0%, #000 6%, #000 66%, transparent 96%);
}

.upt-pioneer__portrait[data-pioneer-id="ohm"] .upt-pioneer__image {
  filter: url(#uptPioneerCleanEdge) saturate(0.52) brightness(0.94) contrast(1.12);
}

.upt-pioneer__fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.92);
  background: radial-gradient(circle, rgba(55, 112, 190, 0.34), transparent 52%), linear-gradient(145deg, #0b2a57, #030b1b);
  opacity: 0;
  pointer-events: none;
}

.upt-pioneer__fallback span {
  padding: 0.55rem 0.8rem;
  border: 1px solid rgba(229, 184, 74, 0.62);
  color: #fff;
  font-weight: 650;
  letter-spacing: 0.14em;
}

.upt-pioneer__portrait.is-fallback .upt-pioneer__image { opacity: 0; }
.upt-pioneer__portrait.is-fallback .upt-pioneer__fallback { opacity: 1; }

.upt-pioneer__quote {
  margin: 0;
  max-width: 34ch;
  color: var(--pioneer-gold);
  font-size: clamp(1.08rem, 1.8vw, 1.55rem);
  font-weight: 700;
  line-height: 1.38;
  letter-spacing: 0.08em;
  overflow-wrap: anywhere;
  text-transform: uppercase;
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.36);
}

.upt-pioneer__author {
  margin: 0;
  color: #f0d37a;
  font-size: clamp(0.78rem, 1.1vw, 0.96rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.upt-pioneer__brand {
  position: relative;
  text-align: center;
  padding: clamp(1.35rem, 4vw, 2.3rem) clamp(2rem, 7vw, 5rem);
  border: 1px solid rgba(151, 181, 224, 0.14);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(10, 31, 61, 0.68), rgba(4, 15, 33, 0.5));
  box-shadow: 0 24px 64px rgba(0, 7, 22, 0.32);
  backdrop-filter: blur(12px);
}

.upt-pioneer__brand::before {
  content: "";
  display: block;
  width: clamp(3rem, 12vw, 5.5rem);
  height: 2px;
  margin: 0 auto 1rem;
  background: linear-gradient(90deg, transparent, var(--pioneer-gold), transparent);
}

.upt-pioneer__subtitle {
  margin: 0 0 0.65rem;
  color: var(--pioneer-muted);
  font-size: clamp(0.64rem, 1.5vw, 0.8rem);
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.upt-pioneer__fie {
  margin: 0;
  color: #fff;
  font-size: clamp(3.2rem, 12vw, 6.5rem);
  font-weight: 650;
  letter-spacing: 0.14em;
  line-height: 1;
  opacity: 0;
  transform: translateY(5px) scale(0.995);
  text-shadow: 0 10px 26px rgba(0, 0, 0, 0.38);
}

.upt-pioneer.is-brand-phase .upt-pioneer__fie {
  animation: uptPioneerBrand var(--pioneer-brand-duration) cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@keyframes uptPioneerPortrait {
  0% { opacity: 0; transform: translateY(8px) scale(0.994); }
  18%, 80% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-3px) scale(1.002); }
}

@keyframes uptPioneerBrand {
  0% { opacity: 0; transform: translateY(5px) scale(0.995); letter-spacing: 0.18em; }
  28%, 72% { opacity: 1; transform: translateY(0) scale(1); letter-spacing: 0.14em; }
  100% { opacity: 0; transform: translateY(-2px) scale(1); letter-spacing: 0.15em; }
}

@media (max-width: 760px) {
  .upt-pioneer { padding: max(0.85rem, env(safe-area-inset-top)) 0.85rem max(0.85rem, env(safe-area-inset-bottom)); }
  .upt-pioneer__card { width: 100%; height: calc(100dvh - 1.7rem); min-height: 0; padding: 0; }
  .upt-pioneer__copy {
    top: auto;
    bottom: max(3.5rem, env(safe-area-inset-bottom));
    left: 50%;
    width: min(34ch, 91vw);
    padding: 0;
    text-align: center;
    transform: translateX(-50%);
  }
  .upt-pioneer__portrait {
    top: 34%;
    left: 57%;
    width: min(820px, 138vw, 64svh);
    aspect-ratio: 4 / 5;
    height: auto;
    transform: translate(-50%, -50%);
  }
  .upt-pioneer__portrait[data-pioneer-id="kirchhoff"],
  .upt-pioneer__portrait[data-pioneer-id="faraday"],
  .upt-pioneer__portrait[data-pioneer-id="ohm"] { top: calc(34% + 2.5dvh); }
  .upt-pioneer__image {
    -webkit-mask-image:
      linear-gradient(to right, transparent 0%, #000 19%, #000 81%, transparent 100%),
      linear-gradient(to bottom, transparent 0%, #000 14%, #000 76%, transparent 100%);
    -webkit-mask-composite: source-in;
    mask-image:
      linear-gradient(to right, transparent 0%, #000 19%, #000 81%, transparent 100%),
      linear-gradient(to bottom, transparent 0%, #000 14%, #000 76%, transparent 100%);
    mask-composite: intersect;
  }
  .upt-pioneer__portrait[data-pioneer-id="faraday"] .upt-pioneer__image,
  .upt-pioneer__portrait[data-pioneer-id="ohm"] .upt-pioneer__image {
    -webkit-mask-image:
      linear-gradient(to right, transparent 0%, #000 11%, #000 89%, transparent 100%),
      linear-gradient(to bottom, transparent 0%, #000 5%, #000 60%, transparent 88%);
    mask-image:
      linear-gradient(to right, transparent 0%, #000 11%, #000 89%, transparent 100%),
      linear-gradient(to bottom, transparent 0%, #000 5%, #000 60%, transparent 88%);
  }
  .upt-pioneer__quote { max-width: 31ch; margin-inline: auto; font-size: clamp(0.9rem, 4.2vw, 1.12rem); line-height: 1.38; }
  .upt-pioneer__hold-hint { bottom: max(0.65rem, env(safe-area-inset-bottom)); font-size: 0.68rem; }
}

@media (max-height: 640px) {
  .upt-pioneer__card { height: calc(100dvh - 1.5rem); min-height: 0; padding: 0; }
  .upt-pioneer__portrait { left: 72%; width: min(1173px, 108.8vw, 119.68dvh); aspect-ratio: 4 / 5; height: auto; }
  .upt-pioneer__copy { left: clamp(0.25rem, 2vw, 2rem); width: min(32ch, 38%); padding: 0; }
  .upt-pioneer__quote { font-size: clamp(0.95rem, 1.7vw, 1.25rem); line-height: 1.34; }
}

@media (max-width: 760px) and (max-height: 640px) {
  .upt-pioneer__portrait { top: 31%; left: 57%; width: min(760px, 132vw, 61svh); aspect-ratio: 4 / 5; height: auto; }
  .upt-pioneer__portrait[data-pioneer-id="kirchhoff"],
  .upt-pioneer__portrait[data-pioneer-id="faraday"],
  .upt-pioneer__portrait[data-pioneer-id="ohm"] { top: calc(31% + 2.5dvh); }
  .upt-pioneer__copy { top: auto; bottom: max(1.25rem, env(safe-area-inset-bottom)); left: 50%; width: min(36ch, 92vw); transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .upt-pioneer.is-portrait-phase .upt-pioneer__card,
  .upt-pioneer.is-brand-phase .upt-pioneer__fie { animation: none; opacity: 1; transform: none; }
}

/* Premium FIE workspace — scoped, additive overrides */
:root {
  --fie-navy-950: #061225;
  --fie-navy-900: #0a1b34;
  --fie-navy-800: #102746;
  --fie-blue: #3d7ee8;
  --fie-blue-soft: #75a7f5;
  --fie-gold: #e5b94f;
  --fie-text: #f4f7fc;
  --fie-muted: #b9c7dc;
  --fie-border: rgba(157, 184, 225, 0.18);
  --fie-shadow: 0 18px 48px rgba(0, 8, 24, 0.28);
}

.role-selector {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.site-header {
  background: rgba(6, 18, 37, 0.88);
  border-bottom: 1px solid var(--fie-border);
  box-shadow: 0 10px 36px rgba(0, 6, 18, 0.2);
  backdrop-filter: blur(18px) saturate(125%);
}

.panel-surface,
.chat-panel,
.profile-card,
.home-command-card {
  border: 1px solid var(--fie-border);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(20, 45, 78, 0.82), rgba(7, 23, 46, 0.9));
  box-shadow: var(--fie-shadow);
}

.role-hidden {
  display: none !important;
}

.home-items-list,
#profHomeEventsList {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.premium-event-card {
  height: 100%;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border-radius: 16px;
  border-color: var(--fie-border);
  background: rgba(8, 26, 50, 0.88);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.premium-event-card:hover {
  transform: translateY(-3px);
  border-color: rgba(229, 185, 79, 0.48);
  box-shadow: 0 18px 36px rgba(0, 8, 24, 0.34);
}

.event-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 8.5;
  overflow: hidden;
  background: var(--fie-navy-800);
}

.event-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 42%, rgba(6, 18, 37, 0.74));
}

.event-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.82) contrast(1.04);
}

.event-media-placeholder {
  display: grid;
  place-content: center;
  justify-items: center;
  background:
    radial-gradient(circle at 78% 20%, rgba(61, 126, 232, 0.34), transparent 34%),
    linear-gradient(135deg, #0d2a51, #07172e);
}

.event-media-placeholder::before {
  content: "";
  position: absolute;
  width: 160px;
  height: 160px;
  border: 1px solid rgba(229, 185, 79, 0.24);
  border-radius: 50%;
}

.event-media-placeholder span {
  z-index: 1;
  color: var(--fie-gold);
  font-size: clamp(2rem, 6vw, 3.4rem);
  font-weight: 800;
  letter-spacing: 0.18em;
}

.event-media-placeholder small {
  z-index: 1;
  color: var(--fie-text);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.event-card-content {
  display: grid;
  gap: 0.7rem;
  padding: 1rem;
  flex: 1;
}

.event-card-badges,
.event-card-meta,
.notice-meta,
.official-post-head,
.workspace-card-head,
.materials-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.event-card-badges > span,
.event-status,
.priority-badge {
  border-radius: 999px;
  padding: 0.24rem 0.52rem;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.event-card-badges > span:first-child {
  color: var(--fie-blue-soft);
  background: rgba(61, 126, 232, 0.14);
}

.event-status {
  color: var(--fie-gold) !important;
  background: rgba(229, 185, 79, 0.12) !important;
}

.status-completed { color: var(--fie-muted) !important; }
.status-active { box-shadow: inset 0 0 0 1px rgba(229, 185, 79, 0.26); }

.event-card-meta {
  align-self: end;
  color: var(--fie-muted);
  font-size: 0.75rem;
}

.event-detail-media {
  margin-bottom: 1rem;
  overflow: hidden;
  border-radius: 14px;
}

.event-media-detail { aspect-ratio: 16 / 6; }

.notice-row {
  position: relative;
  overflow: hidden;
  min-height: 112px;
  border-radius: 14px;
}

.notice-row::before,
.management-item::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--fie-blue);
}

.priority-urgent::before { background: var(--fie-gold); }
.priority-important::before { background: #79a8f2; }

.notice-meta {
  justify-content: flex-start;
  margin-bottom: 0.32rem;
  color: var(--fie-muted);
  font-size: 0.68rem;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 0.22rem 0.5rem;
  color: var(--fie-text);
  background: rgba(255, 255, 255, 0.07);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.role-dean { color: var(--fie-gold); border-color: rgba(229, 185, 79, 0.4); background: rgba(229, 185, 79, 0.11); }
.role-admin { color: #9ec1fb; border-color: rgba(61, 126, 232, 0.4); background: rgba(61, 126, 232, 0.12); }
.role-professor { color: #d9e6fb; }

.channel-tabs {
  display: flex;
  gap: 0.45rem;
  padding: 0.45rem;
  margin: 0.8rem 0 0;
  border: 1px solid var(--fie-border);
  border-radius: 13px;
  background: rgba(4, 15, 31, 0.5);
}

.channel-tab {
  flex: 1;
  border: 0;
  border-radius: 9px;
  padding: 0.68rem 0.8rem;
  color: var(--fie-muted);
  background: transparent;
  font-weight: 700;
  cursor: pointer;
}

.channel-tab.active {
  color: var(--fie-text);
  background: linear-gradient(135deg, rgba(61, 126, 232, 0.35), rgba(61, 126, 232, 0.18));
  box-shadow: inset 0 0 0 1px rgba(117, 167, 245, 0.22);
}

.privacy-note {
  color: #c6d3e6;
  font-size: 0.78rem;
  line-height: 1.5;
}

.privacy-note {
  margin: 0.7rem 0;
  padding: 0.55rem 0.7rem;
  border-left: 2px solid var(--fie-gold);
  background: rgba(229, 185, 79, 0.06);
}

.official-feed {
  display: grid;
  gap: 0.8rem;
  max-height: 520px;
  overflow: auto;
  padding: 0.4rem;
}

.official-post {
  padding: 1rem;
  border: 1px solid var(--fie-border);
  border-radius: 14px;
  background: rgba(10, 29, 55, 0.72);
}

.official-post-head { margin-bottom: 0.65rem; color: var(--fie-muted); font-size: 0.75rem; }
.official-post-head > div { display: flex; align-items: center; gap: 0.55rem; }
.official-post p { color: var(--fie-text); line-height: 1.55; }

.faculty-questions {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.8rem;
  padding: 0.8rem;
  border: 1px solid rgba(229, 185, 79, 0.22);
  border-radius: 12px;
  background: rgba(229, 185, 79, 0.05);
}

.faculty-questions article {
  padding: 0.6rem;
  border-radius: 9px;
  background: rgba(3, 15, 31, 0.45);
}

.faculty-questions strong { color: var(--fie-gold); font-size: 0.76rem; }
.faculty-questions p { color: var(--fie-text); font-size: 0.82rem; }

.question-composer,
.prof-official-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  margin-top: 0.8rem;
}

.prof-official-composer { grid-template-columns: minmax(0, 1fr) minmax(180px, .6fr) auto; }
.question-composer .form-status { grid-column: 1 / -1; }

.class-selector { padding: 1rem; margin-bottom: 1rem; }
.class-search-row { display: grid; grid-template-columns: minmax(260px, 1.8fr) repeat(3, minmax(130px, .7fr)); gap: 0.65rem; }
.class-search-row input,
.class-search-row select,
.workspace-form input,
.workspace-form textarea,
.workspace-form select,
.assignment-form select,
.question-composer input,
.prof-official-composer input {
  width: 100%;
  border: 1px solid var(--fie-border);
  border-radius: 10px;
  background: rgba(3, 14, 29, 0.72);
  color: var(--fie-text);
  padding: 0.72rem 0.8rem;
}

.prof-groups-layout { grid-template-columns: minmax(300px, .85fr) minmax(0, 1.65fr); gap: 1rem; }
.professor-course-card { display: grid; gap: 0.8rem; padding: 1rem; cursor: default; }
.course-card-top { display: flex; justify-content: space-between; align-items: center; }
.course-next { color: var(--fie-gold); font-size: 0.72rem; font-weight: 700; }
.professor-course-card .group-meta p,
.professor-course-card .group-meta small { color: var(--fie-muted); }
.course-card-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.course-card-actions button,
.quick-action-btn {
  border: 1px solid var(--fie-border);
  border-radius: 8px;
  padding: 0.48rem 0.58rem;
  color: var(--fie-text);
  background: rgba(61, 126, 232, 0.12);
  font-size: 0.7rem;
  cursor: pointer;
}

.quick-actions { display: flex; gap: 0.45rem; flex-wrap: wrap; margin: 0.75rem 0; }
.quick-action-btn:hover { border-color: rgba(229, 185, 79, 0.48); color: var(--fie-gold); }

.materials-list { display: grid; gap: 0.6rem; margin: 0.85rem 0; }
.materials-heading { color: var(--fie-text); font-weight: 700; }
.materials-heading small,
.materials-empty { color: var(--fie-muted); font-size: 0.78rem; }
.material-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.75rem; padding: 0.75rem; border: 1px solid var(--fie-border); border-radius: 12px; background: rgba(3, 15, 31, 0.48); }
.material-card h4 { overflow: hidden; text-overflow: ellipsis; color: var(--fie-text); font-size: 0.86rem; }
.material-card p,
.material-card small { color: var(--fie-muted); font-size: 0.7rem; }
.file-type { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; color: #fff; background: #244f8f; font-size: 0.62rem; font-weight: 800; }
.file-pdf { background: #8e3540; }
.file-doc { background: #285f9f; }
.file-image { background: #316b61; }
.file-link { background: #77622d; }
.material-open { text-decoration: none; }

.workspace-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.workspace-card { padding: clamp(1rem, 2vw, 1.4rem); }
.workspace-card-wide { grid-column: 1 / -1; }
.workspace-card-head { margin-bottom: 1rem; }
.workspace-form { display: grid; gap: 0.8rem; }
.workspace-form label { display: grid; gap: 0.35rem; color: var(--fie-muted); font-size: 0.78rem; }
.form-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }
.admin-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.7rem; margin-bottom: 1rem; }
.admin-stat { display: grid; gap: 0.15rem; padding: 0.85rem; border: 1px solid var(--fie-border); border-radius: 12px; background: rgba(3, 15, 31, 0.45); }
.admin-stat strong { color: var(--fie-gold); font-size: 1.45rem; }
.admin-stat span { color: var(--fie-muted); font-size: 0.75rem; }
.admin-management-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.management-list { display: grid; gap: 0.5rem; margin-top: 0.55rem; list-style: none; }
.management-item { position: relative; display: flex; justify-content: space-between; gap: 0.7rem; padding: 0.72rem 0.8rem; overflow: hidden; border: 1px solid var(--fie-border); border-radius: 10px; background: rgba(3, 15, 31, 0.44); }
.management-item h4 { color: var(--fie-text); font-size: 0.82rem; }
.management-item p,
.management-item > span { color: var(--fie-muted); font-size: 0.7rem; }
.assignment-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 0.6rem; margin-top: 1rem; }
.icon-action { width: 28px; height: 28px; border: 1px solid var(--fie-border); border-radius: 8px; color: var(--fie-muted); background: transparent; cursor: pointer; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(2, 9, 20, 0.76);
  backdrop-filter: blur(10px);
}
.modal-card { width: min(620px, 100%); padding: 1.2rem; border: 1px solid rgba(229, 185, 79, 0.22); border-radius: 18px; background: linear-gradient(145deg, #102846, #07172e); box-shadow: 0 30px 80px rgba(0, 5, 16, 0.54); }
.modal-head { display: flex; justify-content: space-between; gap: 1rem; align-items: center; margin-bottom: 1rem; }

@media (max-width: 1000px) {
  .class-search-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prof-groups-layout { grid-template-columns: 1fr; }
  .workspace-grid { grid-template-columns: 1fr; }
  .workspace-card-wide { grid-column: auto; }
}

@media (max-width: 760px) {
  .role-selector { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-items-list,
  #profHomeEventsList { grid-template-columns: 1fr; }
  .home-item-row.notice-row { grid-template-columns: auto minmax(0, 1fr); }
  .home-item-actions,
  .home-item-time { grid-column: 2; justify-items: start; }
  .event-media-detail { aspect-ratio: 16 / 9; }
  .class-search-row,
  .form-grid-2,
  .admin-management-grid,
  .admin-stat-grid,
  .assignment-form { grid-template-columns: 1fr; }
  .prof-official-composer,
  .question-composer { grid-template-columns: 1fr; }
  .channel-tabs { flex-direction: column; }
  .material-card { grid-template-columns: auto minmax(0, 1fr); }
  .material-open { grid-column: 1 / -1; text-align: center; }
}

@media (max-width: 430px) {
  .event-card-content { padding: 0.82rem; }
  .course-card-actions button,
  .quick-action-btn { flex: 1 1 calc(50% - 0.4rem); }
  .official-post { padding: 0.8rem; }
}

/* Privacy-safe public demo indicators */
.demo-version-badge {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: clamp(10px, 2vw, 24px);
  z-index: 10000;
  max-width: min(92vw, 360px);
  padding: 6px 10px;
  border: 1px solid rgba(244, 196, 48, 0.48);
  border-radius: 7px;
  background: rgba(7, 18, 42, 0.9);
  color: #f8fafc;
  box-shadow: 0 8px 24px rgba(2, 8, 23, 0.2);
  font: 700 0.67rem/1.3 "Inter", "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-align: center;
  pointer-events: none;
  backdrop-filter: blur(10px);
}

.demo-mode-notice {
  position: fixed;
  left: 50%;
  bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
  z-index: 10001;
  width: min(calc(100% - 32px), 520px);
  padding: 13px 16px;
  border: 1px solid rgba(244, 196, 48, 0.4);
  border-radius: 10px;
  background: rgba(10, 31, 74, 0.96);
  color: #f8fafc;
  box-shadow: 0 18px 50px rgba(2, 8, 23, 0.38);
  font: 600 0.88rem/1.5 "Inter", "Segoe UI", system-ui, sans-serif;
  text-align: center;
  transform: translateX(-50%);
}

.demo-login-note {
  display: grid;
  gap: 3px;
  margin-top: 2px;
  padding: 10px 12px;
  border: 1px solid rgba(244, 196, 48, 0.2);
  border-radius: 9px;
  background: rgba(8, 24, 54, 0.42);
  color: rgba(238, 244, 255, 0.78);
  font-size: 0.74rem;
  line-height: 1.35;
}

.demo-login-note strong {
  color: #f4c430;
  font-size: 0.7rem;
  letter-spacing: 0.09em;
}

@media (max-width: 640px) {
  .demo-version-badge {
    top: max(8px, env(safe-area-inset-top));
    right: 8px;
    max-width: calc(100vw - 16px);
    font-size: 0.61rem;
  }

  .demo-mode-notice {
    bottom: max(76px, calc(env(safe-area-inset-bottom) + 68px));
  }
}

.login-card {
  width: min(460px, 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  padding: 1.1rem;
}

.login-card h1 {
  font-size: clamp(1.3rem, 4.2vw, 1.9rem);
  margin-bottom: 0.35rem;
}

.auth-form {
  display: grid;
  gap: 0.55rem;
}

.role-selector {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.15rem;
}

.role-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.22rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: #d8e5ff;
  padding: 0.45rem 0.3rem;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
}

.role-btn.active {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.38);
  background: rgba(47, 116, 244, 0.3);
}

.role-icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-form input,
.search-panel input,
.chat-composer input,
.admin-row select,
.new-group-form input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--white-100);
  padding: 0.72rem 0.82rem;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  padding: 0.58rem 0.88rem;
  color: #fff;
  background: transparent;
}

.btn-primary {
  background: linear-gradient(135deg, var(--blue-600), var(--blue-500));
}

.auth-form input:focus,
.search-panel input:focus,
.chat-composer input:focus,
.admin-row select:focus,
.new-group-form input:focus {
  outline: 2px solid rgba(47, 116, 244, 0.8);
  border-color: transparent;
}

.auth-message {
  min-height: 1.2rem;
  font-size: 0.9rem;
  color: #ffd9d4;
}

.auth-message.success {
  color: #b7ffd5;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  padding: 0.58rem 0.88rem;
  color: #fff;
  background: transparent;
}

.btn-primary {
  background: linear-gradient(135deg, var(--blue-600), var(--blue-500));
}

.btn-secondary,
.btn-ghost,
.btn-danger {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.09);
}

.btn-ghost {
  border-radius: 999px;
  font-size: 0.84rem;
  padding: 0.4rem 0.7rem;
}

.btn-danger {
  background: rgba(216, 74, 57, 0.24);
  font-size: 0.8rem;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
  background: rgba(6, 17, 38, 0.9);
  border-bottom: 1px solid var(--border);
}

.top-nav-wrap {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.brand-text {
  font-weight: 700;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.top-nav,
.mobile-nav {
  display: flex;
  gap: 0.35rem;
}

.nav-btn {
  color: #d5e1fa;
  border: 0;
  border-radius: 999px;
  padding: 0.46rem 0.76rem;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.22s ease, color 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
}

.nav-btn:hover {
  color: #ffffff;
  background: rgba(47, 116, 244, 0.2);
  transform: translateY(-1px);
}

.nav-btn.active {
  color: #fff;
  background: rgba(47, 116, 244, 0.33);
  box-shadow: 0 6px 16px rgba(47, 116, 244, 0.24);
}

.nav-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header-auth {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.header-user-status {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  padding: 0.3rem 0.58rem;
  font-size: 0.82rem;
}

.app-main {
  padding-top: 0.8rem;
}

.app-view {
  display: none;
}

.app-view.active {
  display: block;
}

.app-view.view-enter,
.prof-view.view-enter {
  animation: viewSwitchIn 0.3s ease;
}

@keyframes viewSwitchIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-wrap {
  padding-bottom: 1rem;
}

.section-head {
  margin-bottom: 1rem;
}

.kicker {
  color: #bbcefa;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.78rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.section-head h2 {
  margin-bottom: 0.3rem;
}

.section-head p {
  color: #c6d4f1;
}

.home-program-name {
  color: #eaf1ff;
  font-size: 1.9rem;
  font-weight: 700;
  margin-bottom: 0.1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.home-program-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex: 0 0 auto;
}

.home-greeting {
  color: #ffffff;
  font-size: clamp(1rem, 2.2vw, 1.18rem);
  font-weight: 800;
  letter-spacing: 0.2px;
  margin-bottom: 0.4rem;
}

.panel-surface,
.search-panel,
.chat-panel,
.history-panel,
.profile-card,
.grades-card,
.network-card,
.info-card,
.picker-panel,
#newGroupView,
.command-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.info-card,
.history-panel {
  padding: 0.85rem;
}

.info-list,
.history-list,
.picker-list,
.member-list,
.year-averages,
.network-list,
.schedule-list {
  list-style: none;
}

.info-list,
.history-list,
.picker-list {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.5rem;
}

.info-list li,
.history-list li,
.picker-item,
.schedule-list li {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  background: var(--panel-soft);
  padding: 0.45rem 0.55rem;
  color: #d4dff7;
}

.history-btn {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.search-panel {
  padding: 0.85rem;
}

.suggestion-list {
  list-style: none;
  margin-top: 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(9, 30, 61, 0.98);
}

.suggestion-list li button,
.picker-item button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #e8efff;
  padding: 0.55rem 0.7rem;
  cursor: pointer;
}

.search-results {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.6rem;
}

.search-result-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: var(--panel-soft);
  padding: 0.6rem;
}

.search-result-card p {
  color: #cad8f7;
  font-size: 0.9rem;
}

.search-user-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.avatar-chip {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 6px 14px rgba(4, 10, 23, 0.35);
  background: linear-gradient(135deg, #2f74f4, #123367);
  overflow: hidden;
  padding: 2px;
  line-height: 0;
  transform: translateZ(0);
}

.avatar-chip.avatar-student,
.avatar-illustration.avatar-student {
  background: linear-gradient(135deg, #f6a5c8, #de5f9d);
}

.profile-card .avatar-illustration.avatar-student {
  background: linear-gradient(135deg, #2f74f4, #123367);
}

.avatar-chip.avatar-staff,
.avatar-illustration.avatar-staff {
  background: linear-gradient(135deg, #2f74f4, #123367);
}

.avatar-chip-lg {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
}

.avatar-photo {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: 50%;
  background: #d7e6fa;
}

.groups-actions {
  display: flex;
  gap: 0.45rem;
  margin-bottom: 0.7rem;
}

.group-list {
  padding: 0.62rem;
  display: grid;
  gap: 0.45rem;
  max-height: 68vh;
  overflow-y: auto;
}

.group-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: var(--panel-soft);
  padding: 0.55rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.group-card.active {
  border-color: rgba(47, 116, 244, 0.62);
  box-shadow: 0 8px 20px rgba(47, 116, 244, 0.22);
}

.group-icon,
.group-header-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: #f5f9ff;
  background: linear-gradient(135deg, #2f74f4, #123367);
}

.group-meta {
  flex: 1;
  min-width: 0;
}

.group-row {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
}

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

.group-time,
.group-last-message {
  color: #c7d5f3;
  font-size: 0.82rem;
}

.group-last-message {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-panel {
  padding: 0.68rem;
  display: grid;
  gap: 0.56rem;
}

.chat-head-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.5rem;
}

.chat-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-header p {
  color: #cad8f7;
  font-size: 0.83rem;
}

.chat-messages {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: var(--panel-soft);
  min-height: 220px;
  max-height: 320px;
  overflow-y: auto;
  padding: 0.55rem;
  display: grid;
  gap: 0.45rem;
}

.message {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 0.5rem 0.62rem;
  max-width: 82%;
  background: rgba(255, 255, 255, 0.08);
}

.message.outgoing {
  margin-left: auto;
  background: rgba(47, 116, 244, 0.24);
}

.message-meta {
  margin-top: 0.3rem;
  font-size: 0.72rem;
  color: #d4e0fa;
}

.message-attachment {
  margin-top: 0.3rem;
}

.message-attachment img,
.message-attachment video {
  max-width: 220px;
  border-radius: 8px;
}

.message-attachment a {
  color: #ffd88f;
}

.chat-composer {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.45rem;
}

.chat-composer input[type="file"] {
  max-width: 180px;
  padding: 0.4rem;
}

.group-admin {
  padding: 0.6rem;
}

.admin-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}

.member-list {
  display: grid;
  gap: 0.35rem;
  max-height: 165px;
  overflow-y: auto;
}

.member-row {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  background: var(--panel-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.5rem;
}

.member-user,
.picker-person {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.picker-panel,
#newGroupView {
  padding: 0.75rem;
  margin-top: 0.7rem;
}

.picker-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.picker-list {
  display: grid;
  gap: 0.4rem;
  max-height: 250px;
  overflow-y: auto;
}

.new-group-form {
  display: grid;
  gap: 0.5rem;
}

.members-checklist {
  display: grid;
  gap: 0.35rem;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 0.5rem;
  background: var(--panel-soft);
}

.check-item {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.profile-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.profile-card,
.grades-card,
.network-card {
  padding: 0.85rem;
}

.profile-card {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.avatar-illustration {
  width: 112px;
  height: 112px;
  min-width: 112px;
  min-height: 112px;
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.26);
  box-shadow: 0 12px 24px rgba(4, 10, 23, 0.35);
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #2f74f4, #123367);
  padding: 3px;
}

.avatar-illustration::after {
  content: none;
}

.avatar-illustration .avatar-photo {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: 50%;
  background: #d7e6fa;
}

.avatar-photo-lg {
  width: 100%;
  height: 100%;
}

.profile-content h3 {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.55rem;
}

.profile-badge {
  background: var(--yellow-500);
  color: #fff;
  border-radius: 5px;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.12rem 0.4rem;
}

.prof-badge-gold {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #896100 0%, #bf8d12 35%, #efc657 52%, #b68209 70%, #7b5600 100%);
  color: #fff8dc;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.32);
}

.prof-badge-gold::after {
  content: "";
  position: absolute;
  top: -45%;
  left: -70%;
  width: 45%;
  height: 190%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.62), transparent);
  transform: rotate(18deg);
  animation: badgeGoldShine 3.2s ease-in-out infinite;
}

@keyframes badgeGoldShine {
  0% {
    left: -75%;
  }
  55% {
    left: 130%;
  }
  100% {
    left: 130%;
  }
}

.profile-content p {
  color: #ccdbf7;
  font-size: 0.9rem;
}

.radial-wrap {
  display: grid;
  place-items: center;
  margin: 0.55rem 0;
}

.radial-chart {
  width: 156px;
  height: 156px;
  border-radius: 50%;
  background: conic-gradient(var(--green-500) 0 70%, rgba(255, 255, 255, 0.14) 70% 100%);
  display: grid;
  place-items: center;
}

.radial-center {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #0a2148;
  display: grid;
  place-items: center;
}

.radial-center strong {
  font-size: 1.55rem;
  line-height: 1;
}

.radial-center span {
  font-size: 0.82rem;
  color: #c7d5f3;
}

.year-averages {
  display: grid;
  gap: 0.4rem;
}

.year-item,
.network-list li {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: var(--panel-soft);
  padding: 0.45rem 0.52rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
}

.network-list {
  display: grid;
  gap: 0.45rem;
}

.network-list span {
  color: #ccd9f4;
}

.color-chip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.35rem;
}

.profile-actions-row {
  margin-top: 0.9rem;
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
}

.profile-actions-row .btn {
  flex: 1;
}

.command-panel {
  margin-top: 0.7rem;
  padding: 0.8rem;
}

.command-options {
  margin-top: 0.6rem;
  display: grid;
  gap: 0.45rem;
}

.schedule-list {
  margin-top: 0.6rem;
  display: grid;
  gap: 0.45rem;
}

.mobile-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: none;
  background: rgba(6, 17, 38, 0.97);
  border-top: 1px solid var(--border);
  padding: 0.46rem 0.3rem calc(0.5rem + env(safe-area-inset-bottom));
}

.mobile-nav .nav-btn {
  flex: 1;
  flex-direction: column;
  gap: 0.2rem;
  border-radius: 12px;
  font-size: 0.76rem;
  padding: 0.42rem 0.25rem;
}

.site-footer {
  text-align: center;
  color: #c7d5f2;
  font-size: 0.88rem;
  padding: 1rem 0 1.2rem;
}

@media (max-width: 1050px) {
  .home-grid,
  .profile-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body {
    padding-bottom: 72px;
  }

  .top-nav,
  .header-user-status {
    display: none;
  }

  .mobile-nav {
    display: flex;
  }

  .chat-composer {
    grid-template-columns: 1fr;
  }

  .chat-composer input[type="file"] {
    max-width: 100%;
  }

  .chat-head-row {
    grid-template-columns: 1fr;
  }
}

#schedulePanel {
  max-height: 66vh;
  overflow: auto;
}

.schedule-meta {
  margin-top: 0.2rem;
  color: #c9d8f5;
  font-size: 0.86rem;
}

.schedule-departments {
  margin-top: 0.65rem;
  display: grid;
  gap: 0.7rem;
}

.schedule-department {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: var(--panel-soft);
  padding: 0.65rem;
}

.schedule-department h4 {
  color: #eef4ff;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.schedule-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}

.schedule-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.schedule-table th,
.schedule-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.5rem 0.55rem;
  text-align: left;
  color: #dbe6ff;
  vertical-align: top;
}

.schedule-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #ffffff;
  background: rgba(17, 49, 104, 0.95);
}

.schedule-table tbody tr:last-child td {
  border-bottom: 0;
}

@media (max-width: 760px) {
  #schedulePanel {
    max-height: 72vh;
  }
}










.avatar-upload-wrap {
  width: fit-content;
  position: relative;
}

.avatar-illustration {
  border: 0;
  box-shadow: 0 8px 16px rgba(4, 10, 23, 0.24);
  padding: 4px;
}

.profile-photo-btn {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 0;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 1.05rem;
  line-height: 1;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #1f5fe0, #2f74f4);
  box-shadow: 0 6px 14px rgba(4, 10, 23, 0.35);
}

.grades-note {
  margin-top: 0.25rem;
  color: #c9d8f5;
  font-size: 0.86rem;
}

.grades-years {
  margin-top: 0.7rem;
  display: grid;
  gap: 0.65rem;
}

.grade-year-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: var(--panel-soft);
  padding: 0.65rem;
}

.grade-year-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.grade-year-header h4 {
  color: #f0f5ff;
  font-size: 0.95rem;
}

.grade-year-avg {
  font-size: 0.83rem;
  color: #d5e4ff;
}

.grade-list {
  list-style: none;
  display: grid;
  gap: 0.35rem;
}

.grade-row {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.45rem 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}

.grade-course {
  color: #e5eeff;
  font-size: 0.88rem;
}

.grade-value {
  min-width: 52px;
  text-align: center;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0.16rem 0.45rem;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.grade-value.completed {
  background: rgba(36, 163, 87, 0.22);
  color: #b9ffd5;
}

.grade-value.failed {
  background: rgba(216, 74, 57, 0.22);
  color: #ffd8d3;
}

.grade-value.pending {
  background: rgba(255, 255, 255, 0.16);
  color: #d9e6ff;
}

/* Professor React dashboard */
.prof-react-host {
  margin-top: 1.25rem;
}

.prof-react {
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  color: var(--white-100);
}

.prof-react-grid {
  display: grid;
  grid-template-columns: 0.32fr 0.68fr;
  gap: 1.25rem;
  align-items: start;
}

.prof-top-row {
  display: grid;
  grid-template-columns: 0.26fr 0.48fr 0.26fr;
  gap: 1.25rem;
  align-items: stretch;
}

.prof-top-row > .prof-card {
  height: 100%;
}

@media (max-width: 960px) {
  .prof-react-grid {
    grid-template-columns: 1fr;
  }

  .prof-top-row {
    grid-template-columns: 1fr;
  }
}

.prof-card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.32);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.prof-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.36);
  border-color: rgba(47, 116, 244, 0.5);
}

.prof-card-padded {
  padding: 1.25rem;
}

.prof-header-card.prof-card-padded,
.prof-experience-card.prof-card-padded {
  padding: 1rem;
}

.prof-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.prof-avatar-block {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.prof-avatar-actions {
  margin-top: 0.45rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.prof-upload-label {
  cursor: pointer;
}

.prof-upload-input {
  display: none;
}

.prof-avatar {
  width: 112px;
  height: 112px;
  min-width: 112px;
  min-height: 112px;
  flex: 0 0 112px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 3px solid rgba(47, 116, 244, 0.45);
  object-fit: cover;
  background: var(--navy-900);
}

.prof-avatar-initials {
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: linear-gradient(145deg, #0f2b5f, #1f5fe0);
  color: #ffffff;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 24px rgba(4, 10, 23, 0.36);
}

.prof-role {
  color: #b8c9f1;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.prof-name {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.45rem;
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0.1rem 0 0.3rem;
  white-space: nowrap;
}

.prof-name-text {
  white-space: nowrap;
}

.prof-faculty-badge {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 24px;
  padding: 0 0.5rem;
  border-radius: 999px;
  border: 1px solid #ffffff;
  background: linear-gradient(135deg, #9f6b00 0%, #d7a619 36%, #f5d76a 52%, #c99505 72%, #7e5400 100%);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2) inset, 0 6px 14px rgba(201, 149, 5, 0.35);
}

.prof-faculty-badge::after {
  content: "";
  position: absolute;
  top: -40%;
  left: -65%;
  width: 55%;
  height: 180%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  transform: rotate(18deg);
  animation: goldShine 2.8s ease-in-out infinite;
}

@keyframes goldShine {
  0% {
    left: -70%;
  }
  55% {
    left: 135%;
  }
  100% {
    left: 135%;
  }
}

.prof-bio {
  color: #d5e2ff;
  font-size: 0.95rem;
}

.prof-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.prof-sidebar-basic {
  margin-top: 0.45rem;
}

.prof-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.prof-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.prof-chip {
  background: rgba(47, 116, 244, 0.15);
  border: 1px solid rgba(47, 116, 244, 0.35);
  color: #dbe8ff;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.prof-textarea {
  width: 100%;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--white-100);
  font-family: inherit;
  resize: vertical;
}

.prof-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.65rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(47, 116, 244, 0.7);
  background: linear-gradient(120deg, rgba(47, 116, 244, 0.9), rgba(31, 95, 224, 0.9));
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  text-decoration: none;
}

.prof-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(47, 116, 244, 0.35);
}

.prof-btn.primary {
  background: linear-gradient(120deg, #2f74f4, #1f5fe0);
}

.prof-btn.ghost {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border);
  color: #dbe8ff;
}

.prof-empty {
  color: #c4d2f3;
  font-size: 0.92rem;
}

.prof-note-list {
  list-style: disc;
  padding-left: 1.1rem;
  color: #dbe8ff;
  display: grid;
  gap: 0.35rem;
}

.prof-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.prof-experience-head-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.prof-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.prof-sidebar-actions {
  justify-content: flex-start;
  margin-top: 0.5rem;
}

.prof-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.6rem;
}

.prof-info-row {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.prof-info-label {
  color: #b7c8f0;
  font-size: 0.85rem;
}

.prof-info-value {
  font-weight: 700;
  margin-top: 0.15rem;
}

.prof-experience-list {
  display: grid;
  gap: 0.75rem;
}

.prof-experience-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.8rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.prof-experience-item:hover {
  border-color: rgba(47, 116, 244, 0.45);
  background: rgba(47, 116, 244, 0.06);
}

.prof-avatar-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(47, 116, 244, 0.18);
  border: 1px solid rgba(47, 116, 244, 0.4);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #eaf2ff;
}

.prof-exp-title {
  font-weight: 700;
}

.prof-exp-meta {
  color: #c4d2f3;
  font-size: 0.92rem;
}

.prof-exp-range {
  color: #c4d2f3;
  font-weight: 600;
}

.prof-collapse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.prof-detail-stack {
  display: grid;
  gap: 0.75rem;
}

.prof-contact-card .prof-experience-item {
  grid-template-columns: auto 1fr;
}

.prof-collapse button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--white-100);
  cursor: pointer;
}

.prof-collapse-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.1rem;
}

.prof-collapse-icon {
  transition: transform 0.2s ease;
}

.prof-collapse-icon.open {
  transform: rotate(180deg);
}

.prof-collapse-body {
  padding: 0 1.1rem 1rem;
  border-top: 1px solid var(--border);
}

.prof-collapse-body ul {
  list-style: disc;
  padding-left: 1rem;
  display: grid;
  gap: 0.4rem;
  color: #dbe8ff;
}

/* Professor Profile Page Styling */
.profile-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .profile-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

.profile-avatar-section {
  display: flex;
  justify-content: center;
  padding: 1rem 0;
}

.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-info {
  display: grid;
  gap: 0.4rem;
}

.profile-info h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.profile-info p {
  font-size: 0.95rem;
  color: #d4dff7;
  margin: 0.25rem 0;
}

.profile-info p strong {
  color: #e8efff;
  font-weight: 600;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-warning {
  background: var(--yellow-500);
  color: #000;
}

.bio-text {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #d4dff7;
  margin-bottom: 1rem !important;
}

.contact-info {
  display: grid;
  gap: 0.5rem;
}

.contact-info p {
  font-size: 0.9rem;
  color: #d4dff7;
}

.contact-info a {
  color: #6fa8ff;
  text-decoration: none;
  transition: color 0.2s ease;
}

.contact-info a:hover {
  color: #9fc4ff;
  text-decoration: underline;
}

.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.skill-tag {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  background: rgba(47, 116, 244, 0.15);
  border: 1px solid rgba(47, 116, 244, 0.3);
  border-radius: 20px;
  font-size: 0.85rem;
  color: #9fc4ff;
  font-weight: 500;
}

.subjects-list,
.education-list,
.accomplishments-list,
.certifications-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.subjects-list li,
.education-list li,
.accomplishments-list li,
.certifications-list li {
  padding: 0.6rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #d4dff7;
  font-size: 0.9rem;
  line-height: 1.4;
}

.subjects-list li {
  padding: 0.5rem 0.8rem;
}

.education-list li,
.accomplishments-list li,
.certifications-list li {
  padding: 0.7rem;
}

.experience-list {
  display: grid;
  gap: 1rem;
  margin-top: 0.5rem;
}

.experience-item {
  padding: 0.8rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.exp-header {
  display: flex;
  gap: 0.75rem;
}

.exp-avatar {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2f74f4, #123367);
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
}

.exp-info {
  flex: 1;
  min-width: 0;
}

.exp-title {
  font-weight: 600;
  color: #e8efff;
  margin: 0;
  margin-bottom: 0.2rem;
}

.exp-company {
  font-size: 0.85rem;
  color: #9fc4ff;
  margin: 0;
  margin-bottom: 0.2rem;
}

.exp-duration {
  font-size: 0.8rem;
  color: #738dcc;
  margin: 0;
}

.prof-main {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.grade-course {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.search-action-message {
  min-height: 1.1rem;
  margin-top: 0.45rem;
  color: #bcd0f8;
  font-size: 0.86rem;
}

.search-result-card {
  display: grid;
  gap: 0.55rem;
}

.search-result-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.search-user-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.search-user-meta h3 {
  font-size: 0.96rem;
}

.search-user-role {
  color: #c9d9fb;
  font-size: 0.84rem;
}

.search-result-actions {
  display: flex;
  gap: 0.42rem;
}

.result-action-btn {
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #f4f8ff;
  padding: 0.34rem 0.58rem;
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
}

.result-action-btn.sent {
  opacity: 0.72;
}

.result-action-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.public-profile-panel {
  margin-top: 0.7rem;
  padding: 0.78rem;
}

.public-profile-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.public-profile-top {
  margin-top: 0.55rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.public-profile-name {
  color: #f4f8ff;
  font-weight: 800;
}

.public-profile-role {
  color: #c8d8f7;
  font-size: 0.86rem;
}

.public-profile-list {
  list-style: none;
  margin-top: 0.65rem;
  display: grid;
  gap: 0.36rem;
}

.public-profile-list li {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.42rem 0.5rem;
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
}

.public-profile-list span {
  color: #d2dff9;
}

.public-profile-list strong {
  color: #ffffff;
  font-size: 0.9rem;
}

@media (max-width: 760px) {
  .search-result-main {
    flex-direction: column;
    align-items: stretch;
  }

  .search-result-actions {
    justify-content: flex-end;
  }
}

.home-commands {
  display: grid;
  gap: 0.7rem;
}

.home-command-card {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: var(--panel-soft);
  color: #edf3ff;
  padding: 0.72rem;
  display: flex;
  align-items: center;
  gap: 0.72rem;
  cursor: pointer;
  text-align: left;
}

.home-command-card strong {
  display: block;
  font-size: 0.98rem;
}

.home-command-card small {
  display: block;
  color: #cad9fa;
  font-size: 0.82rem;
  margin-top: 0.1rem;
}

.home-command-icon,
.home-item-icon,
.event-detail-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: rgba(47, 116, 244, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.home-command-icon svg,
.home-item-icon svg,
.event-detail-icon svg {
  width: 20px;
  height: 20px;
  stroke: #ffffff;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-page-panel {
  margin-top: 0.7rem;
  padding: 0.75rem;
}

.home-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.home-items-list {
  list-style: none;
  display: grid;
  gap: 0.45rem;
}

.home-item-row {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.55rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.6rem;
  align-items: center;
}

.home-item-body h4 {
  color: #eff5ff;
  font-size: 0.9rem;
}

.home-item-body p {
  color: #cddbf7;
  font-size: 0.82rem;
}

.home-item-time {
  color: #b8ccf5;
  font-size: 0.76rem;
  white-space: nowrap;
}

.home-item-actions {
  display: grid;
  gap: 0.35rem;
  justify-items: end;
}

.home-item-more-btn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(47, 116, 244, 0.15);
  color: #f2f7ff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.24rem 0.5rem;
  cursor: pointer;
}

.home-item-more-btn:hover {
  background: rgba(47, 116, 244, 0.28);
}

.event-card-btn {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.55rem;
  color: #edf3ff;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.6rem;
  align-items: center;
  text-align: left;
  cursor: pointer;
}

.event-item-date {
  margin-top: 0.1rem;
  color: #9fc0f7;
}

.event-detail-box {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.7rem;
}

.event-detail-top {
  display: flex;
  gap: 0.65rem;
  align-items: center;
}

.event-detail-top h4 {
  color: #f3f8ff;
}

.event-detail-date {
  color: #9fc0f7;
  font-size: 0.85rem;
}

.event-detail-body {
  margin-top: 0.55rem;
  color: #d2def7;
}

@media (max-width: 760px) {
  .home-item-row {
    grid-template-columns: auto 1fr;
  }

  .home-item-time {
    grid-column: 2;
  }
}

/* Final specificity layer for legacy event-card rules below the premium block. */
.event-card-btn.premium-event-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 16px;
  background: rgba(8, 26, 50, 0.88);
}

.event-card-btn.premium-event-card .event-media {
  width: 100%;
  aspect-ratio: 16 / 8.5;
}

.event-card-btn.premium-event-card .event-card-content {
  width: 100%;
}

/* Institutional login experience */
.login-gate {
  isolation: isolate;
  padding: clamp(1rem, 3vw, 2.5rem);
  background:
    radial-gradient(circle at 14% 18%, rgba(45, 105, 211, 0.26), transparent 32%),
    radial-gradient(circle at 88% 82%, rgba(229, 185, 79, 0.09), transparent 25%),
    linear-gradient(135deg, #041020 0%, #071b37 48%, #061329 100%);
}

.login-gate::before,
.login-gate::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
}

.login-gate::before {
  inset: 0;
  opacity: 0.2;
  background-image:
    linear-gradient(rgba(120, 160, 220, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 160, 220, 0.08) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(circle at center, #000 12%, transparent 76%);
  mask-image: radial-gradient(circle at center, #000 12%, transparent 76%);
}

.login-gate::after {
  width: 420px;
  height: 420px;
  right: -210px;
  top: -220px;
  border: 1px solid rgba(229, 185, 79, 0.13);
  border-radius: 50%;
  box-shadow: 0 0 0 70px rgba(229, 185, 79, 0.025), 0 0 0 140px rgba(61, 126, 232, 0.025);
}

.login-card {
  width: min(1040px, 100%);
  min-height: min(620px, calc(100vh - 3rem));
  display: grid;
  grid-template-columns: minmax(340px, 0.92fr) minmax(430px, 1.08fr);
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(157, 184, 225, 0.22);
  border-radius: 24px;
  background: rgba(6, 20, 41, 0.82);
  box-shadow: 0 32px 90px rgba(0, 5, 18, 0.52), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(22px) saturate(118%);
}

.login-identity {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: clamp(1.25rem, 3dvh, 2rem);
  overflow: hidden;
  padding: clamp(2rem, 4vw, 3.4rem);
  border-right: 1px solid rgba(157, 184, 225, 0.15);
  background:
    linear-gradient(180deg, rgba(22, 61, 112, 0.7), rgba(7, 25, 50, 0.92)),
    radial-gradient(circle at 30% 18%, rgba(61, 126, 232, 0.4), transparent 46%);
}

.login-identity::before {
  content: "FIE";
  position: absolute;
  right: -0.13em;
  bottom: -0.22em;
  color: rgba(255, 255, 255, 0.025);
  font-size: clamp(9rem, 22vw, 15rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.08em;
}

.login-identity::after {
  content: "";
  position: absolute;
  width: 210px;
  height: 210px;
  right: -105px;
  top: 30%;
  border: 1px solid rgba(229, 185, 79, 0.2);
  border-radius: 50%;
}

.login-brand-lockup,
.login-identity-copy,
.login-trust-row {
  position: relative;
  z-index: 1;
}

.login-brand-lockup {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.login-logo {
  width: 74px;
  height: 74px;
  object-fit: contain;
  padding: 0.35rem;
  border: 1px solid rgba(229, 185, 79, 0.3);
  border-radius: 18px;
  background: rgba(3, 14, 29, 0.34);
  filter: drop-shadow(0 12px 24px rgba(0, 5, 18, 0.32));
}

.login-brand-lockup div {
  display: grid;
  gap: 0.3rem;
}

.login-brand-lockup strong {
  max-width: 260px;
  color: #f7f9fd;
  font-size: 0.83rem;
  line-height: 1.35;
  letter-spacing: 0.055em;
}

.login-brand-lockup span {
  color: var(--fie-gold);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.login-identity-copy {
  max-width: 430px;
}

.login-eyebrow,
.login-form-label,
.login-access-mark {
  color: var(--fie-gold);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.login-card .login-identity-copy h1 {
  margin: 0.75rem 0 1rem;
  color: #f6f8fc;
  font-size: clamp(2rem, 4vw, 3.15rem);
  font-weight: 750;
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.login-identity-copy > p:last-child {
  max-width: 390px;
  color: #c2d0e5;
  font-size: 0.92rem;
  line-height: 1.7;
}

.login-trust-row {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-top: auto;
}

.login-trust-row span {
  padding: 0.4rem 0.68rem;
  border: 1px solid rgba(157, 184, 225, 0.2);
  border-radius: 999px;
  color: #dce7f7;
  background: rgba(4, 16, 33, 0.3);
  font-size: 0.7rem;
  font-weight: 650;
}

.login-access-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(2rem, 5vw, 4rem);
  background: linear-gradient(145deg, rgba(10, 29, 56, 0.88), rgba(6, 19, 39, 0.94));
}

.login-access-head {
  margin-bottom: 1.6rem;
}

.login-access-head h2 {
  margin: 0.55rem 0 0.35rem;
  color: #f7f9fd;
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.login-access-head p {
  color: var(--fie-muted);
  font-size: 0.88rem;
}

.login-access-panel .auth-form {
  gap: 1rem;
}

.login-form-section {
  display: grid;
  gap: 0.55rem;
}

.login-form-label {
  color: #9fb2cf;
  font-size: 0.62rem;
  letter-spacing: 0.13em;
}

.login-access-panel .role-selector {
  gap: 0.55rem;
  margin: 0;
}

.login-access-panel .role-btn {
  min-height: 78px;
  gap: 0.4rem;
  padding: 0.7rem 0.45rem;
  border: 1px solid rgba(157, 184, 225, 0.17);
  border-radius: 13px;
  color: #b9c9df;
  background: rgba(255, 255, 255, 0.025);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.login-access-panel .role-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(117, 167, 245, 0.4);
  color: #f3f7fd;
  background: rgba(61, 126, 232, 0.08);
}

.login-access-panel .role-btn.active {
  color: #ffffff;
  border-color: rgba(117, 167, 245, 0.62);
  background: linear-gradient(145deg, rgba(61, 126, 232, 0.32), rgba(28, 78, 153, 0.18));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035), 0 10px 28px rgba(12, 58, 132, 0.18);
}

.login-access-panel .role-btn.active::after {
  content: "";
  width: 22px;
  height: 2px;
  border-radius: 999px;
  background: var(--fie-gold);
}

.login-access-panel .role-icon {
  width: 23px;
  height: 23px;
}

.login-field {
  display: grid;
  gap: 0.45rem;
  color: #dce6f5;
  font-size: 0.78rem;
  font-weight: 650;
}

.login-input-wrap {
  position: relative;
  display: block;
}

.login-input-wrap > svg {
  position: absolute;
  z-index: 1;
  left: 0.95rem;
  top: 50%;
  width: 19px;
  height: 19px;
  transform: translateY(-50%);
  fill: none;
  stroke: #8298b8;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.login-access-panel .login-input-wrap input {
  height: 51px;
  padding: 0.78rem 0.9rem 0.78rem 3rem;
  border: 1px solid rgba(157, 184, 225, 0.2);
  border-radius: 12px;
  color: #f5f8fd;
  background: rgba(2, 13, 28, 0.54);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.login-access-panel .login-input-wrap input[type="password"],
.login-access-panel .login-input-wrap input#password {
  padding-right: 3.2rem;
}

.password-visibility-toggle {
  position: absolute;
  z-index: 2;
  top: 50%;
  right: 0.75rem;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  cursor: pointer;
}

.password-visibility-toggle .eye-icon {
  width: 20px;
  height: 20px;
  opacity: 0.7;
  fill: none;
  stroke: #fff;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.password-visibility-toggle .eye-icon[hidden] { display: none; }
.password-visibility-toggle:hover .eye-icon,
.password-visibility-toggle:focus-visible .eye-icon { opacity: 1; }
.password-visibility-toggle.clicked .eye-icon { transform: scale(0.85); }
.password-visibility-toggle:focus-visible { outline: 2px solid var(--fie-blue-soft); outline-offset: 1px; border-radius: 6px; }

.login-access-panel .login-input-wrap input::placeholder {
  color: #7185a3;
}

.login-access-panel .login-input-wrap:focus-within input {
  outline: none;
  border-color: rgba(117, 167, 245, 0.72);
  background: rgba(4, 20, 42, 0.72);
  box-shadow: 0 0 0 3px rgba(61, 126, 232, 0.12);
}

.login-access-panel .login-input-wrap:focus-within > svg {
  stroke: var(--fie-blue-soft);
}

.login-submit-btn {
  min-height: 51px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 0.15rem;
  border: 1px solid rgba(117, 167, 245, 0.36);
  border-radius: 12px;
  background: linear-gradient(135deg, #235fbd, #347dde);
  box-shadow: 0 14px 30px rgba(20, 78, 169, 0.28);
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.login-submit-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow: 0 17px 36px rgba(20, 78, 169, 0.34);
}

.login-submit-btn svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-access-panel .auth-message {
  min-height: 1.1rem;
  margin-top: -0.45rem;
  font-size: 0.78rem;
  text-align: center;
}

.login-access-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
  color: #7f93af;
  font-size: 0.68rem;
}

.login-security-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5fc991;
  box-shadow: 0 0 0 4px rgba(95, 201, 145, 0.08);
}

@media (max-width: 820px) {
  .login-gate {
    align-items: start;
  }

  .login-card {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .login-identity {
    min-height: 230px;
    gap: 1.3rem;
    padding: 1.5rem;
    border-right: 0;
    border-bottom: 1px solid rgba(157, 184, 225, 0.15);
  }

  .login-card .login-identity-copy h1 {
    max-width: 620px;
    margin: 0.45rem 0 0.55rem;
    font-size: clamp(1.7rem, 6vw, 2.35rem);
  }

  .login-identity-copy > p:last-child {
    max-width: 620px;
  }

  .login-trust-row {
    display: none;
  }

  .login-access-panel {
    padding: clamp(1.4rem, 6vw, 2.5rem);
  }
}

@media (max-width: 520px) {
  .login-gate {
    padding: 0.7rem;
  }

  .login-card {
    border-radius: 18px;
  }

  .login-identity {
    min-height: auto;
    padding: 1.15rem;
  }

  .login-logo {
    width: 57px;
    height: 57px;
    border-radius: 14px;
  }

  .login-brand-lockup {
    gap: 0.75rem;
  }

  .login-brand-lockup strong {
    font-size: 0.7rem;
  }

  .login-brand-lockup span {
    font-size: 0.56rem;
  }

  .login-card .login-identity-copy h1 {
    font-size: 1.5rem;
  }

  .login-identity-copy > p:last-child {
    display: none;
  }

  .login-access-panel {
    padding: 1.25rem 1rem 1.1rem;
  }

  .login-access-head {
    margin-bottom: 1.2rem;
  }

  .login-access-head h2 {
    font-size: 1.65rem;
  }

  .login-access-panel .role-btn {
    min-height: 70px;
    padding-inline: 0.25rem;
    font-size: 0.69rem;
  }

  .login-access-foot {
    font-size: 0.61rem;
  }
}

/* Login viewport safety: keep every control reachable above browser/taskbar UI. */
html.login-gate-active {
  height: auto;
  min-height: 100%;
  overflow-x: clip;
  overflow-y: auto;
  overscroll-behavior-y: auto;
}

body.login-active {
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: clip;
  overflow-y: auto;
}

.login-gate {
  min-height: 100vh;
  min-height: 100dvh;
  height: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: clamp(24px, 4dvh, 48px);
  padding-right: clamp(12px, 3vw, 40px);
  padding-bottom: max(clamp(40px, 6dvh, 80px), calc(env(safe-area-inset-bottom, 0px) + 28px));
  padding-left: clamp(12px, 3vw, 40px);
  overflow-x: clip;
  overflow-y: visible !important;
  overscroll-behavior-y: auto;
}

.login-card {
  flex: 0 1 1040px;
  width: min(1040px, 100%);
  min-height: 0;
  height: auto;
  max-height: none;
  margin-top: auto;
  margin-bottom: auto;
}

.login-access-panel {
  min-height: 0;
  padding-bottom: clamp(32px, 4dvh, 64px);
}

.login-access-panel .auth-form {
  margin-bottom: 0;
}

.login-submit-btn {
  flex: 0 0 auto;
  margin-bottom: 0.2rem;
}

.login-access-foot {
  flex: 0 0 auto;
  margin-bottom: 0;
  padding-bottom: max(4px, env(safe-area-inset-bottom, 0px));
}

@media (max-height: 780px) and (min-width: 821px) {
  .login-gate {
    padding-top: clamp(16px, 2.5dvh, 24px);
    padding-bottom: max(clamp(32px, 4dvh, 44px), calc(env(safe-area-inset-bottom, 0px) + 24px));
  }

  .login-identity,
  .login-access-panel {
    padding-top: clamp(1.25rem, 3dvh, 1.8rem);
    padding-bottom: clamp(1.25rem, 3dvh, 1.8rem);
  }

  .login-identity {
    gap: clamp(1.25rem, 3dvh, 1.8rem);
  }

  .login-logo {
    width: 64px;
    height: 64px;
  }

  .login-card .login-identity-copy h1 {
    margin-top: 0.45rem;
    margin-bottom: 0.6rem;
    font-size: clamp(1.9rem, 3.5vw, 2.3rem);
  }

  .login-access-head {
    margin-bottom: 1rem;
  }

  .login-access-head h2 {
    font-size: clamp(1.65rem, 2.5vw, 2.05rem);
  }

  .login-access-panel .auth-form {
    gap: 0.7rem;
  }

  .login-form-section { gap: 0.5rem; }
  .login-field { gap: 0.4rem; }

  .login-access-panel .role-btn {
    min-height: 68px;
    padding-block: 0.5rem;
  }

  .login-access-panel .login-input-wrap input,
  .login-submit-btn {
    height: 48px;
    min-height: 48px;
  }

  .login-access-foot {
    margin-top: 0.75rem;
  }
}

@media (max-height: 640px) and (min-width: 821px) {
  .login-card {
    margin-top: 0;
    margin-bottom: 0;
  }

  .login-identity,
  .login-access-panel {
    justify-content: flex-start;
  }

  .login-trust-row {
    display: none;
  }
}

@media (max-height: 540px) and (min-width: 821px) {
  .login-gate {
    padding-top: 12px;
    padding-bottom: max(32px, calc(env(safe-area-inset-bottom, 0px) + 24px));
  }

  .login-identity,
  .login-access-panel {
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  .login-identity {
    gap: 0.7rem;
  }

  .login-logo {
    width: 54px;
    height: 54px;
  }

  .login-card .login-identity-copy h1 {
    margin-top: 0.35rem;
    margin-bottom: 0.45rem;
    font-size: clamp(1.75rem, 3vw, 2.25rem);
  }

  .login-access-head {
    margin-bottom: 0.65rem;
  }

  .login-access-head h2 {
    font-size: 1.55rem;
  }

  .login-access-panel .auth-form {
    gap: 0.52rem;
  }

  .login-access-panel .role-btn {
    min-height: 58px;
    padding-block: 0.35rem;
  }

  .login-access-panel .login-input-wrap input,
  .login-submit-btn {
    height: 44px;
    min-height: 44px;
  }

  .login-access-foot {
    margin-top: 0.45rem;
  }
}

@media (max-width: 820px) {
  .login-gate {
    padding-top: clamp(16px, 3dvh, 28px);
    padding-bottom: max(clamp(40px, 6dvh, 72px), calc(env(safe-area-inset-bottom, 0px) + 28px));
  }

  .login-card {
    margin-top: auto;
    margin-bottom: auto;
  }

  .login-access-panel {
    padding-bottom: max(clamp(28px, 5dvh, 48px), calc(env(safe-area-inset-bottom, 0px) + 20px));
  }
}

@media (max-width: 520px) {
  .login-gate {
    padding-right: 10px;
    padding-left: 10px;
  }

  .login-access-panel .auth-form {
    gap: 0.9rem;
  }

  .login-access-panel .role-selector {
    gap: 0.45rem;
  }

  .login-submit-btn {
    margin-top: 0.25rem;
    margin-bottom: 0.35rem;
  }
}

/* Post-login viewport safety and balanced dashboard spacing. */
html:not(.login-gate-active) {
  height: auto;
  min-height: 100%;
  overflow-x: clip;
  overflow-y: auto;
  overscroll-behavior-y: auto;
}

body:not(.login-active) {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: clip;
  overflow-y: auto;
}

.app-shell {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  height: auto;
  overflow: visible;
  overscroll-behavior-y: auto;
  background-color: #050f21;
}

.app-shell > .app-main {
  flex: 1 0 auto;
  width: 100%;
  min-height: 0;
  padding-top: clamp(24px, 3.5vw, 52px);
}

.app-shell .container {
  width: min(calc(100% - clamp(32px, 5vw, 80px)), 1320px);
}

.app-shell .app-view,
.app-shell .prof-view {
  min-height: auto;
  height: auto;
  overflow: visible;
}

.app-shell .view-wrap {
  min-height: auto;
  height: auto;
  overflow: visible;
  padding-bottom: clamp(80px, 10vh, 140px);
}

.app-shell .section-head {
  margin-bottom: clamp(20px, 2.4vw, 34px);
}

.app-shell .home-commands {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(14px, 1.5vw, 22px);
  margin-bottom: clamp(28px, 4vh, 52px);
}

.app-shell .home-command-card {
  height: 100%;
  min-height: 96px;
  padding: clamp(1rem, 1.8vw, 1.35rem);
  gap: 1rem;
}

.app-shell .home-page-panel,
.app-shell .search-panel,
.app-shell .history-panel,
.app-shell .class-selector,
.app-shell .workspace-card,
.app-shell .chat-panel {
  padding: clamp(1rem, 1.8vw, 1.4rem);
}

.app-shell .home-page-panel,
.app-shell .public-profile-panel,
.app-shell .command-panel {
  margin-top: clamp(16px, 2.2vw, 28px);
}

.app-shell .home-items-list,
.app-shell #profHomeEventsList,
.app-shell .workspace-grid,
.app-shell .admin-management-grid,
.app-shell .prof-groups-layout {
  gap: clamp(16px, 1.8vw, 26px);
}

.app-shell .profile-layout {
  gap: clamp(16px, 1.8vw, 26px);
  align-items: stretch;
}

.app-shell .profile-layout > .profile-card,
.app-shell .profile-layout > .grades-card,
.app-shell .profile-layout > .network-card {
  height: 100%;
  min-height: 0;
  padding: clamp(1rem, 1.8vw, 1.4rem);
}

.app-shell .profile-actions-row {
  margin-top: clamp(20px, 3vw, 36px);
  margin-bottom: clamp(36px, 5vh, 72px);
  gap: clamp(10px, 1.2vw, 18px);
}

.app-shell .profile-cards {
  gap: clamp(16px, 1.8vw, 26px);
  margin-bottom: clamp(48px, 7vh, 96px);
  align-items: stretch;
}

.app-shell .profile-cards > .profile-card {
  height: 100%;
  min-height: 0;
  padding: clamp(1rem, 1.8vw, 1.4rem);
}

.app-shell .site-footer {
  flex: 0 0 auto;
  margin-top: 0;
  padding-top: clamp(24px, 3vh, 40px);
  padding-bottom: clamp(32px, 5vh, 64px);
}

@media (min-width: 821px) and (max-height: 900px) {
  .app-shell #view-profile .view-wrap { padding-bottom: 16px; }
  .app-shell #view-profile .section-head { margin-bottom: 16px; }
  .app-shell #view-profile .profile-layout { gap: 14px; }
  .app-shell #view-profile .profile-layout > .profile-card,
  .app-shell #view-profile .profile-layout > .grades-card,
  .app-shell #view-profile .profile-layout > .network-card { padding: 14px; }
  .app-shell #view-profile .profile-actions-row {
    margin-top: 16px;
    margin-bottom: 16px;
  }

  .app-shell #prof-view-profile .view-wrap { padding-bottom: 24px; }
  .app-shell #prof-view-profile .section-head { margin-bottom: 16px; }
  .app-shell #prof-view-profile .profile-cards {
    gap: 14px;
    margin-bottom: 24px;
  }
}

@media (max-width: 760px) {
  body:not(.login-active) {
    padding-bottom: 0;
  }

  .app-shell > .app-main {
    padding-top: clamp(20px, 5vw, 30px);
  }

  .app-shell .container {
    width: min(calc(100% - 32px), 1320px);
  }

  .app-shell .view-wrap {
    padding-bottom: max(96px, calc(env(safe-area-inset-bottom, 0px) + 88px));
  }

  .app-shell .home-commands {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 32px;
  }

  .app-shell .home-command-card {
    min-height: 88px;
  }

  .app-shell .profile-actions-row {
    flex-wrap: wrap;
    margin-bottom: 48px;
  }

  .app-shell .profile-actions-row .btn {
    flex: 1 1 calc(50% - 10px);
    min-width: 132px;
  }

  .app-shell .profile-cards {
    margin-bottom: 64px;
  }

  .app-shell .site-footer {
    padding-top: 24px;
    padding-bottom: max(92px, calc(env(safe-area-inset-bottom, 0px) + 84px));
  }
}

@media (max-width: 420px) {
  .app-shell .container {
    width: min(calc(100% - 24px), 1320px);
  }

  .app-shell .profile-actions-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .app-shell .profile-actions-row .btn {
    width: 100%;
    min-width: 0;
  }
}

/* Unified FIE faculty badges. Change these variables to retheme them later. */
:root {
  --fie-badge-bachelor: #c99012;
  --fie-badge-master-dark: #59616d;
  --fie-badge-master-light: #b8c0ca;
  --fie-badge-professor-dark: #7b5208;
  --fie-badge-professor-light: #d2a63a;
  --fie-badge-dean-dark: #3f174f;
  --fie-badge-dean-light: #742f78;
  --fie-badge-dean-border: #d6aa3b;
  --fie-badge-admin: #244f88;
}

.fie-badge {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  min-width: 38px;
  padding: 4px 9px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 7px;
  color: #ffffff !important;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(3, 10, 22, 0.5);
  box-shadow: 0 3px 9px rgba(2, 9, 22, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  vertical-align: middle;
}

.fie-badge::after {
  content: "";
  position: absolute;
  z-index: 1;
  top: -55%;
  left: -65%;
  width: 42%;
  height: 210%;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(115deg, transparent 12%, rgba(255, 255, 255, 0.52) 50%, transparent 88%);
  transform: rotate(16deg);
}

.fie-badge--bachelor {
  background: var(--fie-badge-bachelor);
  border-color: rgba(255, 221, 132, 0.5);
}

.fie-badge--bachelor::after,
.fie-badge--admin::after {
  display: none;
  animation: none;
}

.fie-badge--master {
  background: linear-gradient(135deg, var(--fie-badge-master-dark) 0%, #858e99 34%, var(--fie-badge-master-light) 52%, #747d89 72%, #4f5865 100%);
  border-color: rgba(226, 233, 240, 0.56);
}

.fie-badge--professor {
  background: linear-gradient(135deg, var(--fie-badge-professor-dark) 0%, #af7a16 34%, var(--fie-badge-professor-light) 52%, #9a6810 72%, #684406 100%);
  border-color: rgba(244, 207, 112, 0.58);
}

.fie-badge--dean {
  background: linear-gradient(135deg, var(--fie-badge-dean-dark) 0%, #5b2368 42%, var(--fie-badge-dean-light) 62%, #42194f 100%);
  border-color: var(--fie-badge-dean-border);
  box-shadow: 0 4px 12px rgba(32, 8, 48, 0.28), inset 0 1px 0 rgba(255, 228, 157, 0.18);
}

.fie-badge--admin {
  background: linear-gradient(135deg, #17365f, var(--fie-badge-admin));
  border-color: rgba(132, 177, 235, 0.42);
}

.fie-badge--master::after,
.fie-badge--professor::after,
.fie-badge--dean::after {
  opacity: 0.48;
  animation: fieBadgeShine 3.4s ease-in-out infinite;
}

@keyframes fieBadgeShine {
  0%, 22% {
    left: -65%;
  }
  62%, 100% {
    left: 135%;
  }
}

.public-profile-name-row,
.search-role-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

@media (prefers-reduced-motion: reduce) {
  .fie-badge--master::after,
  .fie-badge--professor::after,
  .fie-badge--dean::after {
    animation: none;
    opacity: 0.18;
  }
}

/* Institutional staging adapters reuse the existing navy surfaces and shell. */
.staging-main { min-width: 0; height: auto; overflow: visible; padding-bottom: max(110px, env(safe-area-inset-bottom)); }
.staging-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.staging-heading h1 { font-size: clamp(1.3rem, 3vw, 2rem); }
.staging-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 24px; min-width: 0; }
.staging-card { min-width: 0; padding: clamp(18px, 3vw, 28px); display: flex; flex-direction: column; align-items: stretch; gap: 14px; overflow-wrap: anywhere; }
.staging-card p { white-space: pre-wrap; }
.staging-card h2 { font-size: 1.15rem; }
.staging-form, .staging-field { display: grid; gap: 12px; min-width: 0; }
.staging-form { gap: 20px; }
.staging-field input, .staging-field select, .staging-field textarea { width: 100%; min-width: 0; color: #f8fafc; background: #09172c; border: 1px solid #526782; border-radius: 8px; padding: 12px; font: inherit; }
.staging-field select[multiple] { min-height: 9rem; padding: .5rem; }
.staging-import-preview, .staging-grade-group { overflow-x: auto; }
.staging-import-preview table, .staging-grade-group table { width: 100%; margin-top: .75rem; border-collapse: collapse; font-size: .9rem; }
.staging-import-preview th, .staging-import-preview td, .staging-grade-group th, .staging-grade-group td { padding: .65rem .7rem; border-bottom: 1px solid rgba(148,163,184,.22); text-align: left; }
.staging-import-preview th, .staging-grade-group th { color: #f4c95d; background: rgba(8,30,66,.72); }
.staging-otp[hidden] { display: none; }
.staging-otp { color: #f7f9ff; }
.staging-otp h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
.staging-otp p { color: #cbd5e1; }
.staging-otp-form { display: grid; gap: 16px; margin-top: 24px; }
.staging-otp-boxes { display: grid; grid-template-columns: repeat(var(--otp-length, 6), minmax(0, 1fr)); gap: clamp(4px, 1vw, 10px); }
.staging-otp-boxes input { width: 100%; min-width: 0; aspect-ratio: 1; border: 1px solid #526782; border-radius: 9px; background: #09172c; color: #fff; text-align: center; font: 700 clamp(1.15rem, 4vw, 1.7rem)/1 "Inter", sans-serif; }
.staging-otp-boxes input:focus-visible { outline: 2px solid #f0c71a; outline-offset: 2px; }
.staging-otp-timer { font-variant-numeric: tabular-nums; }
.staging-otp-form .btn { width: 100%; }
.staging-field textarea { min-height: 100px; resize: vertical; }
.staging-status { min-height: 1.5em; color: #dae4f5; margin-block: 20px; overflow-wrap: anywhere; }
.staging-urgent { border-left: 3px solid #e5b84a; }
.staging-main a { color: #b2d5ff; text-decoration: underline; }
.staging-main button:disabled { opacity: .55; cursor: wait; }
.staging-main :focus-visible { outline: 2px solid #e5b84a; outline-offset: 3px; }
.staging-info { color: #c7d1e0; font-size: .88rem; line-height: 1.55; }
/* Keep institutional forms and long content usable at narrow/short viewports. */
.staging-heading { margin-bottom: clamp(16px, 2.5vw, 28px); }
.staging-heading h1 { flex: 1 1 220px; margin: 0; line-height: 1.3; overflow-wrap: anywhere; }
.staging-grid { align-items: start; }
.staging-card h2, .staging-card p { margin: 0; line-height: 1.55; }
.staging-card h2 { line-height: 1.35; }
.staging-card .btn, .staging-heading .btn { min-height: 44px; height: auto; white-space: normal; overflow-wrap: anywhere; line-height: 1.4; }
.staging-card small { line-height: 1.6; overflow-wrap: anywhere; }
.staging-field { line-height: 1.5; }
.staging-field input[type="checkbox"] { width: 22px; height: 22px; }
.staging-field input[type="file"] { max-width: 100%; overflow: hidden; }
.staging-status { line-height: 1.65; }
.login-secondary-action { min-height: 44px; height: auto; white-space: normal; line-height: 1.45; padding-block: 12px; }
.login-access-panel .auth-form { padding-bottom: 12px; }
.staging-otp { padding-bottom: max(24px, env(safe-area-inset-bottom, 0px)); }
@media(max-width:760px) {
  .login-gate { padding-top: 16px; padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px)); }
  .login-identity { padding: 18px; gap: 14px; }
  .login-card .login-identity-copy h1 { font-size: clamp(1.25rem, 5vw, 1.65rem); line-height: 1.25; margin-block: 8px; }
  .login-identity-copy p { font-size: .85rem; line-height: 1.5; margin-block: 8px; }
  .login-access-panel { padding: 22px 18px 28px; gap: 16px; }
  .login-access-head h2 { font-size: 1.6rem; }
  .login-access-head p { line-height: 1.6; }
  .login-access-foot { margin-top: 18px; line-height: 1.6; }
  .app-shell > .staging-main { padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px)); }
  .staging-grid { gap: 18px; }
  .staging-heading { gap: 12px; }
  .staging-heading .btn { flex: 1 1 140px; }
  .staging-card { padding: 18px; }
  .staging-grade-group th, .staging-grade-group td { min-width: 80px; }
}
.document-request-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: .55rem 1rem; padding: 1rem 0; border-bottom: 1px solid rgba(148,163,184,.2); }
.document-request-row:last-child { border-bottom: 0; }
.document-request-row p, .document-request-row small { grid-column: 1 / -1; margin: 0; }
.request-status { align-self: start; padding: .3rem .65rem; border-radius: 999px; font-size: .75rem; font-weight: 800; letter-spacing: .03em; background: rgba(59,130,246,.14); color: #bfdbfe; border: 1px solid rgba(96,165,250,.3); }
.request-status--ready { background: rgba(34,197,94,.13); color: #bbf7d0; border-color: rgba(74,222,128,.3); }
.request-status--rejected { background: rgba(239,68,68,.12); color: #fecaca; border-color: rgba(248,113,113,.28); }
.request-status--in_review { background: rgba(216,182,99,.14); color: #f6dda2; border-color: rgba(216,182,99,.35); }
.document-request-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .25rem; }

/* iOS Safari does not auto-zoom focused fields at 16px or larger. */
@media (max-width: 768px) {
  input, textarea, select { font-size: max(16px, 1rem) !important; }
  .staging-otp-boxes input { font-size: clamp(1.15rem, 4vw, 1.7rem) !important; }
  .document-request-row { grid-template-columns: 1fr; }
  .request-status { justify-self: start; }
  .document-request-row p, .document-request-row small, .document-request-actions { grid-column: 1; }
}
.pwa-install { position:fixed; top:16px; right:16px; z-index:10000; display:flex; align-items:center; gap:12px; max-width:min(650px,calc(100vw - 32px)); padding:14px; border:1px solid #bda15b; border-radius:16px; color:#f3f6fc; background:#0f1b2d; box-shadow:0 8px 32px #0005; }
@media(max-width:640px) { .pwa-install { top:auto; bottom:calc(16px + env(safe-area-inset-bottom)); flex-wrap:wrap; } .pwa-install span { flex-basis:100%; } }
.staging-skeleton { display:grid; gap:16px; grid-column:1/-1; grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr)); }
.skeleton { background:linear-gradient(90deg,#ffffff0d 25%,#ffffff1a 50%,#ffffff0d 75%); background-size:200% 100%; animation:skeleton-pulse 1.5s ease-in-out infinite; border-radius:6px; }
.skeleton-text { height:16px; width:70%; margin-bottom:8px; }
.skeleton-title { height:24px; width:40%; margin-bottom:16px; }
.skeleton-avatar { width:64px; height:64px; border-radius:50%; margin-bottom:16px; }
@keyframes skeleton-pulse { from {background-position:200% 0;} to {background-position:-200% 0;} }
@media(prefers-reduced-motion:reduce) {.skeleton {animation:none;}}
