/* ==========================================================================
   DESIGN TOKENS — "Engineering Blueprint / Spec Sheet"
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --navy-900: #0b1930;
  --navy-800: #0e2140;
  --navy-700: #16304f;
  --navy-600: #1e4067;
  --paper: #eef2f4;
  --paper-line: rgba(14, 33, 64, 0.09);
  --ink: #16213b;
  --ink-soft: #4a5670;
  --ink-faint: #7c869b;
  --white: #ffffff;

  --amber: #ff9f1c;
  --amber-ink: #7a3e00;
  --cyan: #4cc9f0;
  --cyan-ink: #0b5d78;
  --green: #2ecc71;
  --green-ink: #0f6b3a;
  --red: #ef4444;
  --red-ink: #8f1f1f;

  --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;

  --radius: 10px;
  --radius-lg: 16px;
  --shadow-panel: 0 1px 2px rgba(11, 25, 48, 0.06), 0 10px 24px -12px rgba(11, 25, 48, 0.18);
  --shadow-md: 0 2px 6px rgba(11, 25, 48, 0.08), 0 16px 32px -14px rgba(11, 25, 48, 0.24);
  --shadow-lg: 0 10px 30px rgba(11, 25, 48, 0.16), 0 30px 60px -20px rgba(11, 25, 48, 0.38);
  --table-line: rgba(14, 33, 64, 0.16);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: rgba(14,33,64,0.25) transparent; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* Premium themed scrollbars (WebKit) */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background-color: rgba(14,33,64,0.22);
  border-radius: 999px;
  border: 2px solid var(--paper);
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: rgba(14,33,64,0.36); }
.tab-rail::-webkit-scrollbar-thumb, .dash-content::-webkit-scrollbar-thumb { border-color: transparent; }
.tab-rail::-webkit-scrollbar-thumb { background-color: rgba(255,255,255,0.18); }
.tab-rail { scrollbar-color: rgba(255,255,255,0.22) transparent; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; font-weight: 700; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
a:hover, a:focus { color: inherit; }
button { font-family: inherit; cursor: pointer; }

:focus-visible {
  outline: 2.5px solid var(--amber);
  outline-offset: 2px;
}

.mono { font-family: var(--font-mono); }

/* Blueprint grid-paper texture, used behind hero + dashboard content */
.grid-paper {
  background-image:
    linear-gradient(var(--paper-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--paper-line) 1px, transparent 1px);
  background-size: 28px 28px;
}
.grid-paper-dark {
  background-image:
    linear-gradient(rgba(255,255,255,0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.045) 1px, transparent 1px);
  background-size: 28px 28px;
}

/* ==========================================================================
   LANDING PAGE
   ========================================================================== */
.hero {
  background: var(--navy-900);
  color: var(--white);
  padding: 4.5rem 1.5rem 6rem;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 60% 50% at 50% 0%, rgba(76,201,240,0.14), transparent 70%);
  pointer-events: none;
}
.hero-inner { max-width: 1080px; margin: 0 auto; position: relative; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--cyan);
  border: 1px solid rgba(76,201,240,0.35);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(76,201,240,0.08);
}
.eyebrow::before { content: "●"; font-size: 0.55rem; color: var(--amber); }

.hero h1 {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  line-height: 1.08;
  margin: 1.1rem 0 0.9rem;
  font-weight: 700;
  max-width: 16ch;
}
.hero p.lede {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.72);
  max-width: 46ch;
  line-height: 1.6;
}

/* course card grid + circuit-trace connectors */
.course-field {
  position: relative;
  max-width: 1080px;
  margin: -2.75rem auto 0;
  padding: 0 1.5rem 3rem;
}
.trace-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.trace-svg path {
  fill: none;
  stroke: rgba(14,33,64,0.16);
  stroke-width: 1.5;
  stroke-dasharray: 3 5;
}
.course-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.5rem;
}

.course-card {
  display: block;
  text-decoration: none;
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid rgba(14,33,64,0.08);
  box-shadow: var(--shadow-md);
  padding: 1.5rem 1.4rem 1.6rem;
  color: var(--ink);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  position: relative;
}
.course-card:hover, .course-card:focus-visible {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}
.course-card .chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  margin-bottom: 0.9rem;
  color: var(--white);
}
.course-card h3 {
  font-size: 1.18rem;
  line-height: 1.3;
  margin-bottom: 0.4rem;
}
.course-card .tag {
  font-size: 0.86rem;
  color: var(--ink-faint);
  margin-bottom: 1.2rem;
  line-height: 1.4;
}
.course-card .enter {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
}
.course-card .enter svg { width: 14px; height: 14px; transition: transform 0.15s ease; }
.course-card:hover .enter svg { transform: translateX(3px); }
.course-card .node {
  position: absolute;
  width: 10px; height: 10px;
  border-radius: 50%;
  bottom: -6px; left: 50%;
  transform: translateX(-50%);
  border: 2px solid var(--paper);
}

.landing-footer {
  text-align: center;
  padding: 2rem 1.5rem 3rem;
  color: var(--ink-faint);
  font-size: 0.85rem;
}

/* ==========================================================================
   DASHBOARD LAYOUT
   ========================================================================== */
.dash {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.dash-header {
  background: linear-gradient(135deg, var(--navy-900), var(--navy-800) 70%);
  color: var(--white);
  padding: 1.1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 3px solid var(--accent, var(--amber));
  box-shadow: 0 2px 0 rgba(0,0,0,0.15), 0 6px 20px -8px rgba(11,25,48,0.5);
  flex-wrap: wrap;
  position: relative;
  z-index: 5;
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  color: var(--white);
  text-decoration: none;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.15s ease;
}
.back-btn:hover { background: rgba(255,255,255,0.16); }
.back-btn svg { width: 15px; height: 15px; }

.dash-header .titles h1 {
  font-size: 1.25rem;
  font-weight: 600;
}
.dash-header .titles p {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: rgba(255,255,255,0.55);
  margin-top: 0.15rem;
}

.dash-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* Sidebar / tab rail */
.tab-rail {
  background: linear-gradient(180deg, var(--navy-800), var(--navy-900));
  width: 250px;
  flex-shrink: 0;
  padding: 1.25rem 0.75rem;
  overflow-y: auto;
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.05);
}
.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  background: none;
  border: none;
  color: rgba(255,255,255,0.68);
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  font-size: 0.87rem;
  font-weight: 500;
  margin-bottom: 0.15rem;
  border-left: 3px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}
.tab-btn:active { transform: scale(0.98); }
.tab-btn svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.85; }
.tab-btn:hover { background: rgba(255,255,255,0.06); color: var(--white); }
.tab-btn.active {
  background: rgba(255,255,255,0.09);
  color: var(--white);
  border-left-color: var(--accent, var(--amber));
}
.tab-btn .num {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: rgba(255,255,255,0.35);
  margin-left: auto;
}

/* Link to the department dashboards, styled like a tab-btn but NOT one
   (kept out of the .tab-btn selector so app.js's tab-switch handler,
   which only listens on .tab-btn, doesn't intercept its navigation). */
.rail-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  color: rgba(255,255,255,0.68);
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  font-size: 0.87rem;
  font-weight: 500;
  margin-top: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 1.1rem;
}
.rail-link svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.85; }
.rail-link:hover { background: rgba(255,255,255,0.06); color: var(--white); }

.dash-content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 2rem 2.25rem 4rem;
}
.panel {
  max-width: 980px;
  margin: 0 auto;
  animation: panelIn 0.28s ease;
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.panel-head {
  margin-bottom: 1.5rem;
}
.panel-head .k {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent, var(--amber));
  font-weight: 600;
  letter-spacing: 0.04em;
}
.panel-head h2 {
  font-size: 1.55rem;
  margin-top: 0.25rem;
}
.panel-head .sub {
  color: var(--ink-faint);
  font-size: 0.9rem;
  margin-top: 0.35rem;
}

/* Hamburger button (mobile section menu trigger) */
.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  color: var(--white);
  border-radius: 8px;
}
.hamburger-btn:hover { background: rgba(255,255,255,0.16); }

/* Mobile offcanvas nav (Bootstrap component, themed to match the rail) */
.tab-rail-offcanvas {
  background: var(--navy-800);
  color: var(--white);
  max-width: 300px;
}
.tab-rail-offcanvas .offcanvas-header {
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.tab-rail-offcanvas .offcanvas-title { font-family: var(--font-display); font-size: 1.05rem; }
.tab-rail-offcanvas .offcanvas-body { padding: 0.75rem; }

@media (max-width: 900px) {
  .hamburger-btn { display: inline-flex; }
  .tab-rail { display: none; }
  .dash-content { padding: 1.5rem 1.1rem calc(3rem + env(safe-area-inset-bottom)); }
  .back-label { display: none; }
  .btn { padding: 0.6rem 0.95rem; }
  .card-pad { padding: 1.2rem; }
}

/* ==========================================================================
   CARDS / TABLES / SHARED PANEL ELEMENTS
   ========================================================================== */
.card {
  display: block;
  background: var(--white);
  border: 1px solid rgba(14,33,64,0.09);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.card-pad { padding: 1.4rem 1.5rem; }

table.spec {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  border: 1px solid var(--table-line);
}
table.spec th, table.spec td {
  padding: 0.65rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--table-line);
  border-right: 1px solid var(--table-line);
}
table.spec th:last-child, table.spec td:last-child { border-right: none; }
table.spec th {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: #f4f7f8;
  border-bottom: 2px solid var(--table-line);
}
table.spec tr:last-child td { border-bottom: none; }
table.spec td.code, table.spec td.mono-cell { font-family: var(--font-mono); font-size: 0.85rem; color: var(--navy-600); }
table.spec tbody tr { transition: background 0.12s ease; }
table.spec tbody tr:hover { background: #f2f7f9; }

.section-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 1.8rem 0 0.6rem;
}
.section-title:first-child { margin-top: 0; }

.subject-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--table-line);
  transition: background 0.12s ease;
}
.subject-row:hover { background: #f7fafb; }
.subject-row:last-child { border-bottom: none; }
.subject-row .info .code { font-family: var(--font-mono); font-size: 0.76rem; color: var(--navy-600); display: block; }
.subject-row .info .name { font-weight: 500; font-size: 0.95rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid rgba(14,33,64,0.14);
  background: var(--white);
  color: var(--ink);
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  touch-action: manipulation;
}
.btn svg { width: 14px; height: 14px; }
.btn:hover { background: #f2f5f6; border-color: rgba(14,33,64,0.24); color: var(--ink); transform: translateY(-1px); box-shadow: 0 6px 14px -6px rgba(11,25,48,0.25); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn-amber { background: var(--amber); border-color: var(--amber); color: #3a1e00; }
.btn-amber:hover { background: #ffab3d; border-color: #ffab3d; color: #3a1e00; box-shadow: 0 8px 18px -6px rgba(255,159,28,0.5); }
.btn-navy { background: var(--navy-800); border-color: var(--navy-800); color: var(--white); }
.btn-navy:hover { background: var(--navy-700); border-color: var(--navy-700); color: var(--white); box-shadow: 0 8px 18px -6px rgba(14,33,64,0.45); }
.btn-sm { padding: 0.4rem 0.65rem; font-size: 0.78rem; }

.pdf-btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1rem; }
.timetable-actions { margin-bottom: 1.1rem; }

/* Scholarship: official resource cards */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.9rem;
}
.resource-card {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  background: var(--white);
  border: 1px solid rgba(14,33,64,0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel);
  padding: 1rem 1.1rem;
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.resource-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(255,159,28,0.4);
}
.resource-icon {
  flex-shrink: 0;
  width: 38px; height: 38px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,159,28,0.14);
  color: var(--amber-ink);
}
.resource-body { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; flex: 1; }
.resource-title { font-weight: 600; font-size: 0.92rem; line-height: 1.3; }
.resource-desc { font-size: 0.79rem; color: var(--ink-faint); line-height: 1.45; }
.resource-go {
  align-self: flex-end;
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--amber-ink);
  white-space: nowrap;
  margin-top: 0.15rem;
}
.resource-go svg { width: 11px; height: 11px; transform: rotate(-45deg); transition: transform 0.15s ease; }
.resource-card:hover .resource-go svg { transform: rotate(-45deg) translateX(2px); }

/* Scholarship: embedded video tutorials */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.1rem;
}
.video-card {
  background: var(--white);
  border: 1px solid rgba(14,33,64,0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.video-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.video-embed { position: relative; width: 100%; padding-bottom: 56.25%; background: var(--navy-900); }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-title { padding: 0.75rem 0.9rem; font-size: 0.85rem; font-weight: 500; color: var(--ink); }

@media print {
  .dash-header, .tab-rail, .tab-rail-offcanvas, .offcanvas-backdrop, .timetable-actions, .overlay, .hamburger-btn { display: none !important; }
  body, .dash-content { background: #fff !important; padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; }
  .panel-head .k { display: none; }
}

/* Timetable */
.timetable-wrap { overflow-x: auto; }
table.timetable { border-collapse: collapse; width: 100%; min-width: 720px; font-size: 0.83rem; border: 1px solid var(--table-line); }
table.timetable th, table.timetable td {
  border: 1px solid var(--table-line);
  padding: 0.55rem 0.6rem;
  text-align: center;
}
table.timetable thead th {
  background: linear-gradient(180deg, var(--navy-700), var(--navy-800));
  color: var(--white);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.72rem;
  border-color: var(--navy-700);
}
table.timetable td.period-col {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
  text-align: left;
  white-space: nowrap;
  background: #f7f9fa;
}
table.timetable td.cell-break { background: #fff4e0; color: var(--amber-ink); font-weight: 600; font-size: 0.76rem; }
table.timetable td.cell-subject, table.timetable td.cell-activity { text-align: left; vertical-align: middle; }
table.timetable td.cell-subject { background: #f5f9fb; }
table.timetable .cell-subject-name { display: block; font-weight: 600; color: var(--navy-700); font-size: 0.82rem; line-height: 1.25; }
table.timetable .cell-teacher { display: block; font-family: var(--font-mono); font-size: 0.68rem; color: var(--ink-soft); margin-top: 0.2rem; }
table.timetable .cell-room { display: inline-block; font-family: var(--font-mono); font-size: 0.65rem; color: var(--cyan-ink); background: rgba(76,201,240,0.12); padding: 0.05rem 0.4rem; border-radius: 999px; margin-top: 0.25rem; }
table.timetable td.cell-activity .cell-subject-name { color: var(--ink-soft); font-style: italic; font-weight: 500; }

/* Today's classes */
.today-empty { margin: 0; padding: 0.6rem 0.2rem; color: var(--ink-soft); font-size: 0.92rem; }
.today-closed-banner {
  background: #fff4e0;
  border: 1px solid var(--amber);
  color: var(--amber-ink);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  font-size: 0.87rem;
  line-height: 1.5;
  margin-bottom: 0.9rem;
}
.today-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.today-item {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--table-line);
  border-radius: var(--radius);
  background: #f5f9fb;
  position: relative;
}
.today-time {
  flex: 0 0 auto;
  min-width: 108px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
  white-space: nowrap;
}
.today-details { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.today-subject { font-weight: 600; color: var(--navy-700); font-size: 0.88rem; line-height: 1.3; }
.today-teacher { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-soft); }
.today-room {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--cyan-ink);
  background: rgba(76,201,240,0.12);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}
.today-item.today-break { background: #fff4e0; }
.today-item.today-break .today-subject { color: var(--amber-ink); }
.today-item.today-activity .today-subject { color: var(--ink-soft); font-style: italic; font-weight: 500; }
.today-item.today-done { opacity: 0.5; }
.today-item.today-now {
  background: #eafbf1;
  border-color: var(--green);
  box-shadow: 0 0 0 1px var(--green) inset;
}
.today-badge {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--white);
  background: var(--green);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}
@media (max-width: 560px) {
  .today-item { flex-wrap: wrap; }
  .today-time { min-width: auto; }
}

/* Contact / teacher cards */
.avatar {
  width: 58px; height: 58px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2.5px solid var(--white);
  background: var(--paper);
  box-shadow: 0 0 0 1px rgba(14,33,64,0.12), 0 6px 14px -4px rgba(11,25,48,0.25);
}
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}
.contact-card {
  display: flex;
  flex-direction: row;
  gap: 0.85rem;
  padding: 1.1rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.contact-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.contact-card .body { min-width: 0; }
.contact-card .name { font-weight: 600; font-size: 0.95rem; }
.contact-card .designation { font-size: 0.8rem; color: var(--ink-faint); margin-top: 0.1rem; }
.contact-card .meta { margin-top: 0.55rem; font-size: 0.79rem; color: var(--ink-soft); display: flex; flex-direction: column; gap: 0.25rem; }
.contact-card .meta span { display: flex; align-items: center; gap: 0.35rem; }
.contact-card .meta svg { width: 13px; height: 13px; flex-shrink: 0; opacity: 0.65; }

/* Exam pattern */
.exam-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin-top: 0.9rem; }
.total-row td { font-weight: 700; background: #f7f9fa; }
.pass-note {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: #fff4e0;
  color: var(--amber-ink);
  border: 1px solid rgba(255,159,28,0.3);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  margin-top: 0.9rem;
}
.important-points { margin-top: 1rem; font-size: 0.87rem; color: var(--ink-soft); line-height: 1.7; padding-left: 1.1rem; }

/* Exam dates */
.date-list { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 0.9rem; }
.date-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 1rem;
  background: var(--white);
  border-radius: 8px;
  border: 1px solid rgba(14,33,64,0.08);
  box-shadow: var(--shadow-panel);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.date-row:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.date-row .label { font-weight: 500; font-size: 0.92rem; }
.date-row .date { font-family: var(--font-mono); font-size: 0.85rem; color: var(--navy-600); font-weight: 600; }

/* ==========================================================================
   MODAL / PDF VIEWER OVERLAY
   ========================================================================== */
.overlay {
  position: fixed; inset: 0;
  background: rgba(11,25,48,0.55);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
  padding: 1.25rem;
}
.overlay.open { display: flex; animation: overlayIn 0.2s ease; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.overlay-panel {
  background: var(--white);
  border-radius: var(--radius-lg);
  border-top: 4px solid var(--accent, var(--amber));
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: overlayPanelIn 0.25s cubic-bezier(.2,.8,.2,1);
}
@keyframes overlayPanelIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.overlay-panel.wide { max-width: 900px; }
.overlay-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--paper-line);
}
.overlay-top h3 { font-size: 1.05rem; }
.overlay-close {
  background: none; border: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-faint);
}
.overlay-close:hover { background: var(--paper); color: var(--ink); }
.overlay-close svg { width: 16px; height: 16px; }

.teacher-body { padding: 1.5rem; text-align: center; }
.teacher-body .avatar {
  width: 96px; height: 96px;
  font-size: 1.4rem;
  margin: 0 auto 0.9rem;
  border: 3px solid var(--white);
  box-shadow: 0 0 0 3px var(--accent, var(--amber)), 0 12px 28px -8px rgba(11,25,48,0.35);
}
.teacher-body .name { font-size: 1.1rem; font-weight: 600; }
.teacher-body .subj { font-size: 0.85rem; color: var(--ink-faint); margin-top: 0.15rem; font-family: var(--font-mono); }
.teacher-body .contact-list { margin: 1.1rem 0; text-align: left; display: flex; flex-direction: column; gap: 0.6rem; }
.teacher-body .contact-list a {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.87rem; text-decoration: none; color: inherit;
  background: var(--paper); padding: 0.6rem 0.75rem; border-radius: 8px;
}
.teacher-body .contact-list svg { width: 15px; height: 15px; color: var(--navy-600); flex-shrink: 0; }

.pdf-frame-wrap { padding: 1rem 1.25rem 1.25rem; }
.pdf-frame-wrap iframe {
  width: 100%; height: 62vh; border: 1px solid var(--paper-line); border-radius: 8px; background: #e9edef;
}
.pdf-actions { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; margin-top: 0.85rem; }
.pdf-fallback { font-size: 0.82rem; color: var(--ink-faint); margin: 0; }
.pdf-fallback a { color: var(--navy-600); font-weight: 600; }

/* ==========================================================================
   "AM I PASS?" CALCULATOR
   ========================================================================== */
.calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-top: 1rem; }
.field label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 0.35rem; }
.field .hint { font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-faint); margin-left: 0.3rem; }
.field input[type="number"], .field select {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid rgba(14,33,64,0.16);
  border-radius: 8px;
  font-size: 0.92rem;
  font-family: var(--font-mono);
  background: var(--white);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input[type="number"]:focus, .field select:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(255,159,28,0.18);
}
.field input:invalid { border-color: var(--red); }
.field.is-disabled input { background: var(--paper); color: var(--ink-faint); cursor: not-allowed; }
.field-error { font-size: 0.72rem; color: var(--red); margin-top: 0.3rem; display: none; }
.field.has-error .field-error { display: block; }
.field.has-error input { border-color: var(--red); }

.calc-actions { margin-top: 1.4rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

.result-readout {
  margin-top: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid rgba(14,33,64,0.1);
  background: var(--navy-900);
  color: var(--white);
  padding: 1.5rem;
  display: none;
}
.result-readout.show { display: block; animation: readoutIn 0.35s ease; }
@keyframes readoutIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.result-readout .top-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; }
.result-readout .score {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 600;
}
.result-readout .score span { font-size: 1rem; color: rgba(255,255,255,0.5); }
.led {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
}
.led::before { content: ""; width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.led.pass { background: rgba(46,204,113,0.15); color: #6be69a; }
.led.pass::before { background: var(--green); box-shadow: 0 0 8px var(--green); }
.led.warn { background: rgba(255,159,28,0.15); color: #ffc266; }
.led.warn::before { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.led.fail { background: rgba(239,68,68,0.15); color: #ff8a8a; }
.led.fail::before { background: var(--red); box-shadow: 0 0 8px var(--red); }

.result-readout .msg { margin-top: 0.9rem; font-size: 0.92rem; color: rgba(255,255,255,0.78); line-height: 1.6; }
.result-readout .bar-track { margin-top: 1.1rem; height: 8px; border-radius: 999px; background: rgba(255,255,255,0.12); overflow: hidden; }
.result-readout .bar-fill { height: 100%; border-radius: 999px; width: 0%; transition: width 0.6s cubic-bezier(.2,.8,.2,1); }

.reappear-nudge {
  margin-top: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  background: rgba(255,159,28,0.1);
  border: 1px dashed rgba(255,159,28,0.5);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  animation: nudgeIn 0.35s ease;
}
@keyframes nudgeIn { from { opacity: 0; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.reappear-emoji { font-size: 1.6rem; line-height: 1; flex-shrink: 0; }
.reappear-text { display: flex; flex-direction: column; gap: 0.2rem; flex: 1; min-width: 180px; }
.reappear-text strong { font-size: 0.88rem; color: #ffc266; }
.reappear-text span { font-size: 0.82rem; color: rgba(255,255,255,0.75); line-height: 1.5; }

/* sr-only */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
/* ==========================================================================
   RAIL / FOOTER ACTION BUTTONS
   ========================================================================== */
.rail-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.6rem 0.85rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
  touch-action: manipulation;
}

.rail-btn svg,
.rail-btn i {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  fill: currentColor;
  opacity: 0.85;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rail-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.22);
}

.rail-btn:active {
  transform: scale(0.98);
}

/* Specific Accent: Install App Button (Cyan Accent) */
.rail-btn[data-install-app] {
  color: var(--cyan);
  background: rgba(76, 201, 240, 0.12);
  border-color: rgba(76, 201, 240, 0.3);
}

.rail-btn[data-install-app]:hover {
  color: var(--white);
  background: rgba(76, 201, 240, 0.22);
  border-color: var(--cyan);
  box-shadow: 0 4px 12px -2px rgba(76, 201, 240, 0.25);
}

.rail-btn[data-install-app]:hover svg,
.rail-btn[data-install-app]:hover i {
  transform: translateY(2px);
}

/* Specific Accent: Reset App Button (Amber Warning/Refresh) */
.rail-btn[data-reset-app] {
  color: var(--amber);
  background: rgba(255, 159, 28, 0.1);
  border-color: rgba(255, 159, 28, 0.25);
}

.rail-btn[data-reset-app]:hover {
  color: #ffc266;
  background: rgba(255, 159, 28, 0.18);
  border-color: var(--amber);
  box-shadow: 0 4px 12px -2px rgba(255, 159, 28, 0.2);
}

.rail-btn[data-reset-app]:hover svg,
.rail-btn[data-reset-app]:hover i {
  transform: rotate(180deg);
}

/* Optional helper modifier if buttons are placed in light content containers */
.dash-content .rail-btn {
  color: var(--ink);
  background: var(--white);
  border-color: rgba(14, 33, 64, 0.14);
}

.dash-content .rail-btn[data-install-app] {
  color: var(--cyan-ink);
  background: rgba(76, 201, 240, 0.12);
  border-color: rgba(76, 201, 240, 0.35);
}

.dash-content .rail-btn[data-reset-app] {
  color: var(--amber-ink);
  background: #fff7ed;
  border-color: rgba(255, 159, 28, 0.35);
}
