*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --csi-blue: #00599E;
  --csi-blue-dark: #004175;
  --csi-gold: #F2A900;
  --teams-purple: #464EB8;
  --copilot-indigo: #4F46E5;
  --card: #FFFFFF;
  --text: #1E293B;
  --muted: #526375;
  --border: #E2E8F0;
  --radius: 16px;
  --shadow: 0 6px 18px rgba(15, 41, 66, 0.06);
  --shadow-hover: 0 16px 36px rgba(0, 89, 158, 0.16);
}

html, body {
  height: 100%;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  background: radial-gradient(circle at top center, #EAF2FA 0%, #F4F7FB 55%, #EDF1F7 100%);
  color: var(--text);
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

/* Header */
.csi-header {
  background: linear-gradient(90deg, #004A85 0%, #00599E 60%, #0066B5 100%);
  color: #fff;
  height: 76px;
  padding: 0 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}
.gold-bar { height: 5px; background: var(--csi-gold); width: 100%; }

.header-left { display: flex; align-items: center; gap: 16px; min-width: 0; }
.logo-box {
  background: #fff;
  border-radius: 10px;
  height: 48px;
  min-width: 54px;
  padding: 5px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-decoration: none;
  color: var(--csi-blue);
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}
.logo-box img { max-height: 38px; max-width: 140px; width: auto; display: block; object-fit: contain; }
.header-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.user-greeting { font-size: 13.5px; font-weight: 600; opacity: 0.95; }
.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid #fff;
  object-fit: cover;
  background: var(--csi-blue-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  user-select: none;
  pointer-events: none;
}
.btn-logout {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.4);
  background: var(--csi-blue-dark);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}
.btn-logout:hover { background: rgba(255,255,255,0.2); border-color: #fff; transform: translateY(-1px); }

/* Main Container */
.main-content {
  flex: 1;
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  padding: 36px 32px 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Tela de Login */
#screenLogin {
  width: 100%;
  max-width: 1240px;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.login-intro { text-align: center; margin-bottom: 42px; }
.login-intro h1 {
  font-size: 34px;
  font-weight: 800;
  color: #0F2942;
  letter-spacing: -0.4px;
  margin-bottom: 10px;
}
.login-intro p { color: var(--muted); font-size: 16px; }

.login-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  align-items: stretch;
}
.profile-card {
  background: var(--card);
  border: 1px solid rgba(0, 89, 158, 0.12);
  border-radius: 18px;
  min-height: 310px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(15, 41, 66, 0.07);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.profile-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(0, 89, 158, 0.35);
}
.profile-card-bar { height: 7px; background: var(--csi-blue); }
.profile-card-bar.gold { background: var(--csi-gold); }
.profile-card-bar.purple { background: var(--teams-purple); }
.profile-card-body {
  padding: 34px 30px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.profile-badge {
  align-self: flex-start;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 13px;
  border-radius: 999px;
  background: #EBF4FC;
  color: var(--csi-blue);
}
.profile-card h2 { font-size: 22px; font-weight: 700; color: #0F2942; }
.profile-card p {
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.65;
  flex: 1;
  margin-bottom: 14px;
}

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 12px;
  padding: 14px 22px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { filter: brightness(0.93); transform: translateY(-1px); }
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--csi-blue);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 89, 158, 0.22);
}
.btn-teams {
  background: var(--teams-purple);
  color: #fff;
  box-shadow: 0 4px 14px rgba(70, 78, 184, 0.22);
}
.btn-indigo { background: var(--copilot-indigo); color: #fff; }
.btn-danger { background: #C42B1C; color: #fff; }
.btn-outline { background: #F3F9FD; color: var(--csi-blue); border: 2px solid var(--csi-blue); }
.btn-secondary { background: #F3F2F1; color: #323130; border: 1px solid #C8C6C4; }
.btn-full, .profile-card .btn { width: 100%; }

/* Painéis Internos */
#screenProf, #screenAluno, #screenResp { width: 100%; margin-bottom: auto; }
.hub-grid-2col {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px 36px;
  align-items: start;
}
.section-block h3 { font-size: 17.5px; font-weight: 700; margin-bottom: 14px; color: #0F2942; }
.cards-2x2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.app-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  min-height: 104px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
  width: 100%;
}
.app-card:hover {
  transform: translateY(-2px);
  border-color: var(--csi-blue);
  background: #F8FBFF;
  box-shadow: var(--shadow-hover);
}
.app-card svg { width: 46px; height: 46px; flex-shrink: 0; }
.app-card-text { min-width: 0; }
.app-card-title { font-size: 15.5px; font-weight: 700; color: var(--text); }
.app-card-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.app-card-sub.link { color: var(--csi-blue); font-weight: 600; }

/* Suporte */
.support-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 26px;
  min-height: 224px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.support-card.compact {
  min-height: 104px;
  padding: 18px 22px;
  flex-direction: row;
  align-items: center;
  gap: 16px;
}
.support-head { display: flex; align-items: center; gap: 12px; }
.support-head h4 { font-size: 15.5px; font-weight: 700; }
.support-desc { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* Copilot FAB */
.copilot-fab {
  position: fixed;
  right: 24px;
  bottom: 56px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #C7D2FE;
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 40;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.copilot-fab:hover { transform: translateY(-3px) scale(1.04); border-color: var(--copilot-indigo); }
.copilot-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #10B981;
  border: 2px solid #fff;
}

/* Rodapé */
.csi-footer {
  width: 100%;
  background: #E2E8F0;
  border-top: 1px solid #CBD5E1;
  height: 42px;
  padding: 0 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  margin-top: auto;
}
.csi-footer a { color: var(--csi-blue); font-weight: 700; text-decoration: none; }
.csi-footer a:hover { text-decoration: underline; }
.csi-footer span { color: var(--muted); font-weight: 600; }

/* Modais e Toast */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-card {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 540px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-title { font-size: 18px; font-weight: 700; color: var(--csi-blue); }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px; border: none;
  background: #F3F2F1; color: #605E5C; font-weight: 700; cursor: pointer;
}
.modal-desc { font-size: 13.5px; color: var(--muted); line-height: 1.5; margin-bottom: 18px; }
.modal-actions-2, .chips-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.chip-btn {
  background: #EEF2FF;
  border: 1px solid #C7D2FE;
  color: #4338CA;
  font-weight: 600;
  font-size: 12.5px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12.5px; font-weight: 700; margin-bottom: 5px; }
.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #C8C6C4;
  border-radius: 8px;
  font-size: 14px;
}
.resp-student-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.parcela-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid #EFEFEF;
  font-size: 13px;
}
.toast {
  position: fixed;
  top: 86px;
  right: 24px;
  background: #1E293B;
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  z-index: 200;
}

/* Responsivo */
@media (max-width: 920px) {
  .login-grid, .hub-grid-2col { grid-template-columns: 1fr; }
  .user-greeting { display: none; }
}
@media (max-width: 560px) {
  .csi-header, .csi-footer { padding: 0 14px; }
  .csi-header { height: 64px; }
  .header-title { font-size: 14px; }
  .main-content { padding: 18px 14px 80px; }
  .cards-2x2, .chips-grid, .modal-actions-2 { grid-template-columns: 1fr; }
  .support-card.compact { flex-direction: column; align-items: stretch; }
  .csi-footer span { display: none; }
}