/* ==========================================================================
   Al-Ghad International College (GIC) — Student Results Portal Stylesheet
   Brand Colors Extracted Directly from gic_logo.jpg:
   - Deep Academic Navy: #002B46
   - Royal GIC Indigo:   #002060
   - Deep Night Navy:    #001B2E
   - Academic Gold:      #D29704 (hover #B58003, soft #F7ECC8)
   - Warm Ivory / Cream: #EEEBDA (page canvas #F7F5EC)
   ========================================================================== */

:root {
  --gic-navy: #002B46;
  --gic-indigo: #002060;
  --gic-navy-dark: #001B2E;
  --gic-gold: #D29704;
  --gic-gold-dark: #B58003;
  --gic-gold-soft: #F7ECC8;
  --gic-ivory: #EEEBDA;
  --gic-bg: #F7F5EC;
  --gic-surface: #FFFFFF;
  --gic-border: #E4DFCC;
  --gic-text: #0F2233;
  --gic-muted: #546677;

  --status-success: #157347;
  --status-success-bg: #E8F5EE;
  --status-warning: #9A6B00;
  --status-warning-bg: #FEF6DC;
  --status-danger: #B42318;
  --status-danger-bg: #FEECEB;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-shell: 0 28px 64px -18px rgba(0, 27, 46, 0.25), 0 4px 16px rgba(0, 27, 46, 0.08);
  --shadow-card: 0 12px 34px -8px rgba(0, 43, 70, 0.12), 0 2px 8px rgba(0, 43, 70, 0.05);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
  color: var(--gic-text);
  background-color: var(--gic-bg);
  background-image:
    radial-gradient(circle at 12% 16%, rgba(210, 151, 4, 0.12) 0%, transparent 42%),
    radial-gradient(circle at 88% 84%, rgba(0, 43, 70, 0.09) 0%, transparent 45%),
    radial-gradient(rgba(0, 43, 70, 0.055) 1px, transparent 1px);
  background-size: auto, auto, 26px 26px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: 1080px;
  margin-inline: auto;
  padding-inline: 20px;
}

.tabular-num {
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   VIEW 1: MINIMALIST DOCJUS-INSPIRED ACADEMIC LOGIN
   ========================================================================== */
.auth-stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 20px;
}

.login-card {
  width: 100%;
  max-width: 980px;
  min-height: 575px;
  background-color: var(--gic-surface);
  border-radius: 34px;
  border: 1px solid rgba(210, 151, 4, 0.22);
  box-shadow: var(--shadow-shell);
  display: grid;
  grid-template-columns: 0.94fr 1.06fr;
  overflow: hidden;
  animation: fadeUp 0.42s ease-out;
}

/* Form Side (Right in RTL Desktop, Bottom on Mobile) */
.login-form-side {
  padding: 46px 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--gic-surface);
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 30px;
}

.login-logo {
  display: block;
  width: 86px;
  height: 86px;
  object-fit: contain;
  margin-bottom: 10px;
  filter: drop-shadow(0 6px 14px rgba(0, 43, 70, 0.14));
}

.login-title {
  margin: 0;
  font-size: 1.48rem;
  font-weight: 800;
  color: var(--gic-navy);
  line-height: 1.3;
}

.login-subtitle {
  margin: 2px 0 0;
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--gic-muted);
}

.login-form {
  width: 100%;
  max-width: 330px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Minimalist Underline Inputs */
.underline-field {
  position: relative;
  display: flex;
  align-items: center;
  border-bottom: 1.5px solid #CFD5DC;
  transition: border-color 0.22s ease;
}

.underline-field::after {
  content: '';
  position: absolute;
  bottom: -1.5px;
  inset-inline: 50%;
  height: 2px;
  background: linear-gradient(90deg, var(--gic-navy), var(--gic-gold));
  transition: inset-inline 0.24s ease;
}

.underline-field:focus-within::after {
  inset-inline: 0;
}

.field-icon {
  position: absolute;
  right: 4px;
  display: inline-flex;
  color: #7D8997;
  pointer-events: none;
  transition: color 0.2s ease;
}

.field-icon svg {
  width: 18px;
  height: 18px;
}

.underline-field:focus-within .field-icon {
  color: var(--gic-navy);
}

.underline-input {
  width: 100%;
  height: 44px;
  padding: 8px 34px 8px 10px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--gic-text);
  text-align: right;
  letter-spacing: 0.03em;
}

.underline-field--password .underline-input {
  padding-left: 38px;
}

.underline-input::placeholder {
  color: #8A96A3;
  font-weight: 500;
  text-align: right;
  letter-spacing: 0;
}

.underline-input:focus {
  outline: none;
}

.eye-btn {
  position: absolute;
  left: 0;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #7D8997;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: color 0.18s ease, background-color 0.18s ease;
}

.eye-btn:hover {
  color: var(--gic-navy);
  background-color: var(--gic-ivory);
}

.eye-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(210, 151, 4, 0.3);
}

.eye-btn svg {
  width: 18px;
  height: 18px;
}

.eye-btn .icon-eye-closed {
  display: none;
}

.eye-btn.is-visible .icon-eye-open {
  display: none;
}

.eye-btn.is-visible .icon-eye-closed {
  display: block;
}

.id-password-note {
  margin: -4px 0 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: #6B7987;
  text-align: center;
}

/* Error Alert */
.login-error {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background-color: var(--status-danger-bg);
  border: 1px solid #F6C5C0;
  border-inline-start: 4px solid var(--status-danger);
  color: var(--status-danger);
  font-size: 0.84rem;
  font-weight: 600;
  text-align: right;
  animation: gentleShake 0.32s ease;
}

/* Signature Two-Tone Pill Button (Navy + Gold Cap) */
.pill-submit-btn {
  position: relative;
  width: 224px;
  max-width: 100%;
  height: 46px;
  margin: 6px auto 0;
  padding: 0 54px 0 22px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gic-navy) 0%, var(--gic-indigo) 100%);
  color: #FFFFFF;
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 24px -8px rgba(0, 43, 70, 0.52);
  transition: transform 0.16s ease, box-shadow 0.2s ease;
}

.pill-submit-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px -8px rgba(0, 43, 70, 0.62);
}

.pill-submit-btn:active:not(:disabled) {
  transform: translateY(0);
}

.pill-submit-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3.5px rgba(210, 151, 4, 0.42);
}

.pill-submit-btn:disabled {
  opacity: 0.82;
  cursor: wait;
}

.pill-cap {
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  width: 52px;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gic-gold) 0%, #E5B326 100%);
  color: var(--gic-navy-dark);
  display: grid;
  place-items: center;
  box-shadow: 2px 0 10px rgba(0, 27, 46, 0.16);
}

.cap-icon {
  width: 20px;
  height: 20px;
}

.pill-submit-btn .btn-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(0, 27, 46, 0.25);
  border-top-color: var(--gic-navy-dark);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.pill-submit-btn.is-loading .btn-spinner {
  display: inline-block;
}

.pill-submit-btn.is-loading .cap-icon {
  display: none;
}

/* Visual Curve & Illustration Side (Left in RTL Desktop, Top on Mobile) */
.login-art-side {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--gic-surface);
  overflow: hidden;
  padding: 24px;
}

.curve-desktop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.curve-mobile {
  display: none;
  pointer-events: none;
}

.desk-illustration {
  position: relative;
  z-index: 2;
  width: 92%;
  max-width: 420px;
  height: auto;
}

/* Shared Buttons for Authenticated Portal */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 10px 20px;
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3.5px rgba(210, 151, 4, 0.35);
}

.btn-sm {
  min-height: 40px;
  padding: 7px 15px;
  font-size: 0.88rem;
}

.btn-gold {
  background-color: var(--gic-gold);
  color: var(--gic-navy-dark);
}

.btn-gold:hover {
  background-color: var(--gic-gold-dark);
  color: #FFFFFF;
}

.btn-ghost-light {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(247, 236, 200, 0.34);
  color: #FFFFFF;
}

.btn-ghost-light:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.icon-sm {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ==========================================================================
   VIEW 2: AUTHENTICATED RESULT DASHBOARD
   ========================================================================== */
.portal-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  animation: fadeUp 0.35s ease-out;
}

.portal-header {
  background: linear-gradient(135deg, var(--gic-navy-dark) 0%, var(--gic-navy) 58%, var(--gic-indigo) 100%);
  color: #FFFFFF;
  border-bottom: 4px solid var(--gic-gold);
  box-shadow: 0 4px 20px rgba(0, 27, 46, 0.22);
}

.portal-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 14px;
  flex-wrap: wrap;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 13px;
}

.portal-logo {
  display: block;
  width: 54px;
  height: 54px;
  object-fit: contain;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.35));
}

.portal-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
  color: #FFFFFF;
}

.portal-subtitle {
  margin: 0;
  font-size: 0.78rem;
  color: var(--gic-gold-soft);
}

.portal-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.semester-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.semester-switcher label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--gic-gold-soft);
}

.toolbar-select {
  min-height: 40px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(247, 236, 200, 0.34);
  background-color: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.toolbar-select:focus {
  outline: none;
  border-color: var(--gic-gold);
}

.toolbar-select option {
  color: var(--gic-navy);
  background-color: #FFFFFF;
}

.portal-main {
  flex: 1;
  padding-block: 30px 46px;
}

.transcript-sheet {
  background-color: var(--gic-surface);
  border: 1px solid var(--gic-border);
  border-top: 5px solid var(--gic-gold);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.print-letterhead {
  display: none;
}

/* Student Banner */
.student-banner {
  padding: 26px 28px;
  background: linear-gradient(135deg, var(--gic-navy-dark) 0%, var(--gic-navy) 65%, var(--gic-indigo) 100%);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.student-main {
  display: flex;
  align-items: center;
  gap: 16px;
}

.student-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gic-gold) 0%, #ECC24E 100%);
  color: var(--gic-navy-dark);
  border: 3px solid rgba(255, 255, 255, 0.85);
  display: grid;
  place-items: center;
  font-size: 1.45rem;
  font-weight: 800;
  flex-shrink: 0;
}

.student-identity {
  flex: 1;
  min-width: 0;
}

.student-name-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.student-name-row h2 {
  margin: 0;
  font-size: clamp(1.25rem, 2.5vw, 1.6rem);
  font-weight: 800;
  color: #FFFFFF;
}

.student-college-tag {
  margin: 2px 0 0;
  font-size: 0.86rem;
  color: var(--gic-gold-soft);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 13px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.status-pill--success {
  background-color: var(--status-success-bg);
  color: var(--status-success);
}

.status-pill--warning {
  background-color: var(--status-warning-bg);
  color: var(--status-warning);
}

.status-pill--danger {
  background-color: var(--status-danger-bg);
  color: var(--status-danger);
}

.student-meta-grid {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.meta-cell {
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.meta-cell dt {
  font-size: 0.76rem;
  color: var(--gic-gold-soft);
  margin-bottom: 2px;
}

.meta-cell dd {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 700;
  color: #FFFFFF;
}

/* KPI Grid */
.kpi-grid {
  padding: 24px 28px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  background-color: #FAF8F1;
  border-bottom: 1px solid var(--gic-border);
}

.kpi-card {
  background-color: #FFFFFF;
  border: 1px solid var(--gic-border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-highlight {
  border-color: var(--gic-gold);
  background: linear-gradient(180deg, #FFFDF6 0%, #FFFFFF 100%);
}

.kpi-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gic-muted);
}

.kpi-value {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--gic-navy);
  line-height: 1.25;
}

.kpi-sub {
  font-size: 0.79rem;
  font-weight: 600;
  color: var(--gic-muted);
}

.kpi-progress {
  margin-top: 6px;
  height: 7px;
  border-radius: 999px;
  background-color: var(--gic-ivory);
  overflow: hidden;
}

.kpi-progress span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gic-gold-dark) 0%, var(--gic-gold) 100%);
  transition: width 0.55s ease;
}

/* Grades Table */
.grades-section {
  padding: 24px 28px 26px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-header h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--gic-navy);
}

.count-badge {
  padding: 4px 12px;
  border-radius: 999px;
  background-color: var(--gic-ivory);
  border: 1px solid var(--gic-border);
  color: var(--gic-navy);
  font-size: 0.82rem;
  font-weight: 700;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--gic-border);
  border-radius: var(--radius-md);
}

.grades-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  text-align: center;
  font-size: 0.92rem;
}

.grades-table thead th {
  background-color: var(--gic-navy);
  color: #FFFFFF;
  font-weight: 700;
  padding: 13px 12px;
  white-space: nowrap;
  border-bottom: 3px solid var(--gic-gold);
}

.th-max {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--gic-gold-soft);
}

.grades-table tbody td {
  padding: 13px 12px;
  border-bottom: 1px solid #ECE7D8;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.grades-table tbody tr:nth-child(even) {
  background-color: #FCFBF7;
}

.grades-table tbody tr:hover {
  background-color: #F7F3E3;
}

.grades-table tbody tr.row-fail {
  background-color: #FFF7F6;
}

.grades-table tbody td.col-name {
  text-align: right;
  font-weight: 700;
  color: var(--gic-navy);
}

.grades-table tbody td.col-code {
  font-weight: 700;
  color: var(--gic-indigo);
  direction: ltr;
}

.grades-table tfoot td {
  padding: 13px 12px;
  background-color: var(--gic-ivory);
  font-weight: 800;
  color: var(--gic-navy);
  border-top: 2px solid var(--gic-gold);
  font-variant-numeric: tabular-nums;
}

.grade-badge {
  display: inline-block;
  min-width: 38px;
  padding: 3px 9px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 0.84rem;
  direction: ltr;
}

.grade-badge--pass {
  background-color: var(--status-success-bg);
  color: var(--status-success);
}

.grade-badge--mid {
  background-color: var(--status-warning-bg);
  color: var(--status-warning);
}

.grade-badge--fail {
  background-color: var(--status-danger-bg);
  color: var(--status-danger);
}

.course-status {
  display: inline-flex;
  align-items: center;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.course-status--pass {
  background-color: var(--status-success-bg);
  color: var(--status-success);
}

.course-status--fail {
  background-color: var(--status-danger-bg);
  color: var(--status-danger);
}

/* Transcript Footer */
.transcript-footer {
  padding: 18px 28px 24px;
  background-color: #FAF8F1;
  border-top: 1px solid var(--gic-border);
}

.disclaimer {
  margin: 0;
  font-size: 0.83rem;
  color: var(--gic-muted);
  text-align: center;
}

.print-signatures {
  display: none;
}

.site-footer {
  background-color: var(--gic-navy-dark);
  color: #D8E1E8;
  border-top: 3px solid var(--gic-gold);
  padding-block: 16px;
  text-align: center;
  font-size: 0.84rem;
}

.site-footer p {
  margin: 0;
}

/* ==================== Animations ==================== */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes gentleShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(5px); }
  75% { transform: translateX(-5px); }
}

/* ==================== Responsive Breakpoints ==================== */
@media (max-width: 860px) {
  .auth-stage {
    padding: 18px 14px;
  }

  .login-card {
    max-width: 440px;
    min-height: auto;
    display: flex;
    flex-direction: column-reverse;
    border-radius: 30px;
  }

  .login-art-side {
    min-height: 235px;
    padding: 20px 18px 6px;
  }

  .curve-desktop {
    display: none;
  }

  .curve-mobile {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }

  .desk-illustration {
    width: 78%;
    max-width: 265px;
    margin-top: 6px;
  }

  .login-form-side {
    padding: 14px 28px 34px;
    justify-content: flex-start;
  }

  .login-brand {
    margin-bottom: 24px;
  }

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

  .student-meta-grid,
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .auth-stage {
    padding: 10px;
  }

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

  .login-art-side {
    min-height: 215px;
  }

  .login-form-side {
    padding: 10px 22px 30px;
  }

  .login-title {
    font-size: 1.32rem;
  }

  .pill-submit-btn {
    width: 100%;
    max-width: 260px;
  }

  .portal-header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .portal-toolbar {
    width: 100%;
  }

  .semester-switcher {
    width: 100%;
  }

  .toolbar-select {
    flex: 1;
  }

  .student-banner,
  .kpi-grid,
  .grades-section,
  .transcript-footer {
    padding-inline: 18px;
  }

  .student-meta-grid,
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* ==================== Official A4 Print Layout ==================== */
@media print {
  @page {
    size: A4;
    margin: 12mm;
  }

  * {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  body {
    background: #FFFFFF;
    color: #000000;
  }

  #login-view,
  .no-print,
  .portal-header,
  .site-footer {
    display: none !important;
  }

  .portal-main {
    padding: 0;
    max-width: 100%;
  }

  .transcript-sheet {
    border: 1.5px solid var(--gic-navy);
    border-top: 4px solid var(--gic-gold);
    border-radius: 0;
    box-shadow: none;
  }

  .print-letterhead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    border-bottom: 2px solid var(--gic-gold);
    background-color: #FAF8F0;
  }

  .print-brand {
    display: flex;
    align-items: center;
    gap: 14px;
  }

  .print-brand h2 {
    margin: 0;
    font-size: 1.12rem;
    color: var(--gic-navy);
  }

  .print-brand p {
    margin: 2px 0 0;
    font-size: 0.72rem;
    color: var(--gic-muted);
  }

  .print-brand .print-dept {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--gic-indigo);
  }

  .print-meta {
    font-size: 0.82rem;
    color: var(--gic-navy);
  }

  .student-banner {
    padding: 16px 20px;
  }

  .kpi-grid {
    padding: 14px 20px;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
  }

  .grades-section {
    padding: 14px 20px;
  }

  .table-responsive {
    overflow: visible;
  }

  .grades-table {
    min-width: 100%;
    font-size: 0.84rem;
  }

  .grades-table tr,
  .kpi-card {
    break-inside: avoid;
  }

  .transcript-footer {
    padding: 14px 20px 18px;
  }

  .print-signatures {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 22px;
    padding-inline: 24px;
  }

  .sig-box {
    text-align: center;
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--gic-navy);
  }

  .sig-line {
    width: 170px;
    height: 36px;
    border-bottom: 1.5px dashed var(--gic-navy);
  }

  .sig-stamp {
    width: 72px;
    height: 72px;
    margin: 8px auto 0;
    border: 2px dashed var(--gic-gold-dark);
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--gic-navy);
    font-weight: 800;
    opacity: 0.7;
  }
}

/* ==================== Next.js integration additions ==================== */
.kpi-grid.kpi-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grades-table.grades-table--4 { min-width: 560px; }
.grades-table .col-name { text-align: right; }
.withheld-box {
  margin: 28px;
  padding: 28px 22px;
  text-align: center;
  border: 2px solid var(--gic-gold);
  background: var(--status-warning-bg);
  border-radius: var(--radius-md);
}
.withheld-box h3 { margin: 0 0 8px; color: var(--gic-navy); font-size: 1.15rem; font-weight: 800; }
.withheld-box p { margin: 0; color: var(--status-warning); font-weight: 700; }
.honeypot-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 860px) { .kpi-grid.kpi-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .kpi-grid.kpi-grid--3 { grid-template-columns: 1fr; } }
@media print { .kpi-grid.kpi-grid--3 { grid-template-columns: repeat(3, 1fr); } }

/* Security Single-Student Lock Modal Dialog */
dialog:modal {
  overscroll-behavior: contain;
}
dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
}
.security-lock-dialog {
  margin: auto;
  padding: 0;
  border: 2px solid var(--gic-gold);
  border-radius: 20px;
  background: #FFFFFF;
  color: var(--gic-navy);
  width: min(92vw, 430px);
  box-shadow: 0 24px 56px rgba(0, 27, 46, 0.35);
}
.security-lock-dialog::backdrop {
  background-color: rgba(0, 27, 46, 0.65);
  backdrop-filter: blur(3px);
}
.security-lock-dialog__body {
  padding: 28px 24px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.security-lock-dialog__icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #FFF7E6;
  border: 2px solid var(--gic-gold);
  color: #B58003;
  display: grid;
  place-items: center;
}
.security-lock-dialog__icon svg {
  width: 30px;
  height: 30px;
}
.security-lock-dialog__title {
  margin: 4px 0 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--gic-navy);
}
.security-lock-dialog__msg {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.7;
  font-weight: 600;
  color: #334155;
}
.security-lock-dialog__actions {
  width: 100%;
  margin-top: 8px;
}
.security-lock-dialog__btn {
  width: 100%;
  padding: 12px 20px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gic-navy) 0%, #002060 100%);
  color: #FFFFFF;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.security-lock-dialog__btn:hover {
  opacity: 0.94;
  transform: translateY(-1px);
}

/* ==================== Mobile result view: same layout as desktop, fitted to phone width ==================== */
@media screen and (max-width: 640px) {
  .portal-main { padding-inline: 10px; }
  .portal-header-inner { flex-direction: row; align-items: center; }
  .portal-title { font-size: 0.92rem; }
  .portal-subtitle { font-size: 0.75rem; }

  .student-banner { padding: 18px 14px; gap: 14px; }
  .student-avatar { width: 46px; height: 46px; font-size: 1.15rem; }
  .student-meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding-top: 12px; }
  .meta-cell { padding: 8px 10px; min-width: 0; }
  .meta-cell dt { font-size: 0.7rem; }
  .meta-cell dd { font-size: 0.84rem; overflow-wrap: anywhere; }

  .kpi-grid.kpi-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 14px 12px; }
  .kpi-card { padding: 10px 8px; min-width: 0; }
  .kpi-label { font-size: 0.72rem; }
  .kpi-value { font-size: 1.05rem; overflow-wrap: anywhere; }
  .kpi-sub { font-size: 0.66rem; }

  .grades-section { padding: 16px 12px 18px; }
  .section-header h3 { font-size: 0.98rem; }
  .count-badge { font-size: 0.72rem; padding: 3px 9px; white-space: nowrap; }

  .table-responsive { overflow-x: visible; }
  .grades-table { min-width: 0; table-layout: fixed; font-size: 0.84rem; }
  .grades-table thead th { padding: 10px 6px; font-size: 0.8rem; white-space: normal; }
  .grades-table tbody td, .grades-table tfoot td { padding: 10px 6px; overflow-wrap: anywhere; }
  .grades-table th:first-child, .grades-table td:first-child { width: 36px; }
  .grades-table th:last-child, .grades-table td:last-child { width: 82px; }
  .grades-table tfoot td { font-size: 0.78rem; }

  .transcript-footer { padding: 14px 14px 18px; }
  .disclaimer { font-size: 0.74rem; }
}

/* Mobile: each course is a card, course-name label on top, course name under it, then the score */
@media screen and (max-width: 640px) {
  .table-responsive { border: 0; overflow: visible; }
  .grades-table,
  .grades-table tbody,
  .grades-table tfoot { display: block; width: 100%; min-width: 0; }
  .grades-table thead { display: none; }

  .grades-table tbody tr {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    column-gap: 10px;
    align-items: start;
    margin-bottom: 10px;
    padding: 12px;
    background: #FFFFFF;
    border: 1px solid var(--gic-border);
    border-inline-start: 4px solid var(--gic-gold);
    border-radius: var(--radius-md);
    text-align: right;
  }
  .grades-table tbody tr:nth-child(even) { background: #FFFFFF; }
  .grades-table tbody td,
  .grades-table tfoot td { width: auto !important; border: 0; padding: 0; text-align: right; }

  .grades-table tbody td:first-child {
    grid-column: 1; grid-row: 1 / span 2;
    width: 30px !important; height: 30px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--gic-ivory);
    color: var(--gic-navy);
    font-size: 0.8rem; font-weight: 800;
  }
  .grades-table tbody td.col-name { grid-column: 2; grid-row: 1; font-size: 0.95rem; line-height: 1.5; }
  .grades-table tbody td.col-name::before {
    content: "اسم المقرر الدراسي";
    display: block;
    margin-bottom: 2px;
    font-size: 0.7rem; font-weight: 600;
    color: var(--gic-muted);
  }
  .grades-table tbody td:last-child {
    grid-column: 2; grid-row: 2;
    display: flex; align-items: baseline; gap: 8px;
    margin-top: 8px; padding-top: 8px;
    border-top: 1px dashed var(--gic-border);
    font-size: 1rem;
  }
  .grades-table tbody td:last-child::before {
    content: "الدرجة";
    font-size: 0.72rem; font-weight: 600;
    color: var(--gic-muted);
  }

  .grades-table tfoot tr {
    display: grid; grid-template-columns: 1fr; gap: 6px;
    padding: 12px;
    background: var(--gic-ivory);
    border: 1px solid var(--gic-border);
    border-top: 2px solid var(--gic-gold);
    border-radius: var(--radius-md);
  }
  .grades-table tfoot td { background: transparent; border: 0 !important; font-size: 0.84rem; }
  .grades-table tfoot td:first-child { font-size: 0.95rem; }
}
