@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --ink: #141414;
  --ink-2: #262626;
  --red: #D7263D;
  --red-dark: #A81C2E;
  --red-tint: #FBE9EB;
  --paper: #FCFCFB;
  --paper-2: #F5F5F5;
  --line: #E5E5E5;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(20,20,20,.06);
  --shadow-md: 0 4px 16px rgba(20,20,20,.08);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: 'Archivo', -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--paper-2);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

.mono { font-family: 'IBM Plex Mono', monospace; }

a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }

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

h2, h3, h4 { font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 22px; }
h3 { font-size: 16px; }

/* ---------- Nav ---------- */
.topbar {
  background: var(--ink);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: var(--shadow-md);
}
.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
}
.brand {
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: #fff;
}
.brand span { color: var(--red); }
.brand:hover { text-decoration: none; opacity: .9; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 34px;
  height: 34px;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
}
.nav-toggle span { display: block; width: 20px; height: 2px; background: #fff; border-radius: 2px; }

.nav-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap; /* insurance: never force a horizontal overflow just above the breakpoint */
  gap: 4px;
  padding: 0 16px 10px;
  font-size: 14px;
}
.nav-links a {
  color: rgba(255,255,255,.72);
  padding: 6px 10px;
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.nav-links a:hover { color: #fff; text-decoration: none; background: rgba(255,255,255,.08); }
.nav-links a.active { color: #fff; background: rgba(215,38,61,.35); font-weight: 600; }

.nav-account {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 10px;
}
.nav-account .who { color: rgba(255,255,255,.75); font-size: 12px; }
.role-badge { background: rgba(255,255,255,.14); color: #fff; }
.logout-link { color: rgba(255,255,255,.85) !important; padding: 6px 10px; }
.logout-link:hover { background: rgba(255,255,255,.08); }

/* Collapse the nav to the hamburger at 1024px, not 760px. A 1366px laptop at
   125%/150% Windows display scaling reports ~910-1093 CSS px — above the old
   760px cutoff, so it was getting the full horizontal desktop nav crammed into
   laptop width. 1024px covers that whole scaled-laptop range. */
@media (max-width: 1024px) {
  .nav-toggle { display: flex; }
  .nav-links {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 4px 12px 14px;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 12px; }
  .nav-account { margin-left: 0; flex-wrap: wrap; padding: 10px 12px 0; border-top: 1px solid rgba(255,255,255,.12); margin-top: 6px; }
}

/* ---------- Layout ---------- */
.container { max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

@media (max-width: 700px) {
  .container { padding: 16px 14px 48px; }
  .card { padding: 16px; overflow-x: auto; }
}

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 20%, #1f1f1f 0%, var(--ink) 60%);
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 340px;
  background: #fff;
  border-radius: 12px;
  padding: 32px;
  box-shadow: var(--shadow-md);
}
.login-card h1 { font-size: 18px; margin: 0 0 20px; }

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--ink-2); }
input[type=text], input[type=password], input[type=search], input[type=number], select, textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: 'Archivo', -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  margin-bottom: 14px;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus { border-color: var(--red); }
textarea { font-family: 'IBM Plex Mono', monospace; min-height: 90px; }

button, .btn {
  display: inline-block;
  background: var(--red);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: 6px;
  font-family: 'Archivo', -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
button:hover, .btn:hover { background: var(--red-dark); text-decoration: none; }
button:active, .btn:active { transform: translateY(1px); }
.btn-secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-secondary:hover { background: var(--paper-2); }

.error { color: var(--red-dark); font-size: 13px; margin-bottom: 12px; }
.muted { color: #6b6b6b; font-size: 13px; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: #8a8a8a; font-weight: 700; }
tr:hover td { background: var(--paper-2); }

@media (max-width: 700px) {
  table { min-width: 560px; }
}

.filters { display: flex; gap: 10px; margin-bottom: 16px; align-items: flex-end; flex-wrap: wrap; }
.filters > div { min-width: 160px; }
.filters label, .filters input, .filters select { margin-bottom: 0; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.02em;
}
.badge-new { background: var(--paper-2); color: #444; }
.badge-under_review { background: #FDF0D5; color: #8A6100; }
.badge-accepted { background: #E2F1E7; color: #1E7A3B; }
.badge-rejected { background: var(--red-tint); color: var(--red-dark); }
.badge-enrolled { background: #E2ECFB; color: #1A5FA8; }

.ref-code { font-family: 'IBM Plex Mono', monospace; font-size: 13px; }

.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

.doc-list { list-style: none; padding: 0; margin: 0; }
.doc-list li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}
.doc-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--paper-2);
}
.doc-thumb-link { display: block; }
.doc-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  display: block;
}
.doc-thumb-generic {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  background: #fff;
  color: #9a9a9a;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.05em;
}
.doc-meta { font-size: 12px; line-height: 1.4; }

.log-list { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.log-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.log-list .when { color: #6b6b6b; font-family: 'IBM Plex Mono', monospace; font-size: 12px; }

.field-row { margin-bottom: 12px; }
.field-row .k { font-size: 11px; color: #8a8a8a; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; }
.field-row .v { font-size: 14px; }

/* ---------- Dashboard stats ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); border-top: 3px solid var(--red); }
.stat-card .num { font-size: 26px; font-weight: 800; font-family: 'IBM Plex Mono', monospace; }
.stat-card .label { font-size: 11px; color: #8a8a8a; text-transform: uppercase; letter-spacing: 0.04em; margin-top: 4px; font-weight: 700; }

/* ---------- Fee table ---------- */
.fee-table { width: 100%; margin-bottom: 10px; }
.fee-table td { padding: 4px 0; border: none; font-size: 14px; }
.fee-table td.amt { text-align: right; font-family: 'IBM Plex Mono', monospace; }
.fee-table tr.total td { border-top: 1px solid var(--line); font-weight: 700; padding-top: 8px; }
.balance-positive { color: var(--red-dark); font-weight: 700; }
.balance-zero { color: #1E7A3B; font-weight: 700; }

@media print {
  .topbar, .no-print { display: none !important; }
  body { background: #fff; }
  .container { max-width: 100%; padding: 0; }
  .card { border: none; box-shadow: none; }
}
/* ============================================================
   Portal (LMS) additions — extends the shared admin design system.
   Same tokens, fonts, and card/badge language; a few extra pieces
   for dashboards, course outlines, and assignments.
   ============================================================ */

/* Role tint on the topbar brand so students/teachers can tell the
   portal apart from the admin at a glance (same ink bar, portal wording). */
.brand .portal-tag { color: rgba(255,255,255,.6); font-weight: 600; font-size: 12px; margin-left: 6px; }

/* First-login / notice banners */
.banner {
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  background: #fff;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
}
.banner.info    { border-left-color: #1A5FA8; }
.banner.warn    { border-left-color: #8A6100; background: #FFFBF2; }
.banner.success { border-left-color: #1E7A3B; background: #F3FAF5; }
.banner a { font-weight: 600; }

/* Page heading with a mono eyebrow */
.page-head { margin-bottom: 22px; }
.page-head .eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--red); font-weight: 500; margin: 0 0 6px;
}
.page-head h2 { margin: 0; }
.page-head p.sub { color: #6b6b6b; font-size: 14px; margin: 6px 0 0; }

/* Info grid inside cards */
.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 14px; }
.kv .k { font-size: 11px; color: #8a8a8a; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.kv .v { font-size: 15px; margin-top: 2px; }

/* Course outline — preserves line breaks, easy to read */
.outline {
  white-space: pre-wrap;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--ink-2);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.outline.empty { color: #9a9a9a; font-style: italic; }

/* Assignment list rows */
.assignment-list { list-style: none; padding: 0; margin: 0; }
.assignment-list li {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.assignment-list .a-main { flex: 1 1 260px; min-width: 0; }
.assignment-list .a-title { font-weight: 700; font-size: 15px; margin: 0 0 4px; }
.assignment-list .a-meta { font-size: 12.5px; color: #6b6b6b; font-family: 'IBM Plex Mono', monospace; }
.assignment-list .a-side { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

/* Deadline / fine emphasis */
.deadline { font-family: 'IBM Plex Mono', monospace; font-size: 13px; }
.deadline.overdue { color: var(--red-dark); font-weight: 700; }
.fine-tag {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; font-weight: 700;
  color: var(--red-dark); background: var(--red-tint);
  padding: 3px 8px; border-radius: 100px;
}
.demo-note { font-size: 11px; color: #9a9a9a; font-style: italic; }

/* Submission box */
.submit-box { border: 1px dashed var(--line); border-radius: var(--radius); padding: 16px; background: var(--paper-2); }

/* Simple stacked list for teacher submission review */
.sub-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr auto; gap: 10px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.sub-row .name { font-weight: 600; }
@media (max-width: 640px) {
  .sub-row { grid-template-columns: 1fr 1fr; }
}

/* Empty states */
.empty-state { text-align: center; padding: 40px 20px; color: #9a9a9a; }
.empty-state .big { font-size: 15px; color: #6b6b6b; margin-bottom: 4px; }

/* Tidy the login card heading for the portal */
.login-card .login-sub { font-size: 13px; color: #6b6b6b; margin: -10px 0 18px; }

/* ---------- Fees ---------- */
.fee-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.fee-table td { padding: 7px 0; border-bottom: 1px solid var(--line); }
.fee-table td.amt { text-align: right; font-family: 'IBM Plex Mono', monospace; white-space: nowrap; }
.fee-table tr.total td { border-bottom: none; border-top: 2px solid var(--ink); font-weight: 800; padding-top: 10px; }
.balance-zero     { color: #1E7A3B; }
.balance-positive { color: var(--red-dark); }

/* ---------- UI polish ---------- */
/* Stat cards get a coloured top rule so the three numbers read as a set */
.stat-card { border-top: 3px solid var(--ink); }
.stat-card .label { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: #6b6b6b; font-weight: 700; }

/* Cards lift slightly on hover where they're clickable */
.assignment-list li { transition: box-shadow .15s ease, transform .15s ease; }
.assignment-list li:hover { box-shadow: 0 3px 14px rgba(0,0,0,.09); }

/* Links inside content areas get the brand underline treatment */
.card a:not(.btn):not(.badge) { color: var(--red-dark); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.card a:not(.btn):not(.badge):hover { color: var(--red); }

/* Buttons: clearer affordance + disabled state */
.btn, button[type="submit"] { transition: background .15s ease, opacity .15s ease; }
button[disabled] { opacity: .5; cursor: not-allowed; }

/* Tables breathe more */
table th { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: #6b6b6b; }
table td, table th { padding: 10px 8px; }
table tbody tr:hover { background: var(--paper-2); }

/* Brand mark alignment in the topbar */
.brand img { display: inline-block; }

/* Focus visibility — keyboard users and accessibility */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* Mobile: stack the two-column layouts and keep tables scrollable */
@media (max-width: 780px) {
  .two-col { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .container { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 460px) {
  .stats-grid { grid-template-columns: 1fr; }
  .assignment-list li { flex-direction: column; }
  .assignment-list .a-side { align-items: flex-start; text-align: left; }
}
