* { box-sizing: border-box; }

:root {
  --brand: #9d1737;
  --burgundy: #9d1737;
  --burgundy-dark: #76102a;
  --cyan: #08a8cc;
  --cyan-dark: #047f9c;
  --gold: #fdbd17;
  --navy: #25375d;
  --ink: #20262d;
  --muted: #657079;
  --line: #dedbd4;
  --line-soft: #ece9e3;
  --paper: #fffdf9;
  --bg: #f4f3ef;
  --good: #27654b;
}

html { background: var(--bg); scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(157, 23, 55, .025), transparent 34%),
    repeating-linear-gradient(0deg, rgba(32, 38, 45, .014) 0 1px, transparent 1px 7px),
    var(--bg);
  font-family: 'Nunito Sans', 'Avenir Next', 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

a { color: var(--burgundy); text-underline-offset: 4px; text-decoration-thickness: 1px; }
a:hover { color: var(--burgundy-dark); }
button, input, select, textarea { font: inherit; }

button,
.button {
  min-height: 46px;
  padding: 11px 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--burgundy);
  border-radius: 8px;
  color: #fff;
  background: var(--burgundy);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: .035em;
  text-decoration: none;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, background-color .16s ease;
}

button:hover,
.button:hover {
  color: #fff;
  background: var(--burgundy-dark);
  filter: none;
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(118, 16, 42, .16);
}

button.secondary,
.button.secondary {
  color: var(--burgundy);
  background: transparent;
  border-color: #c9b9bc;
}

button.secondary:hover,
.button.secondary:hover { color: var(--burgundy-dark); background: #fff7f8; }
button.danger { background: #7d1830; border-color: #7d1830; }
button:disabled { opacity: .62; cursor: wait; }

:focus-visible { outline: 3px solid var(--cyan); outline-offset: 4px; }

.skip {
  position: fixed;
  z-index: 40;
  left: 14px;
  top: -70px;
  padding: 10px 14px;
  color: #fff;
  background: var(--burgundy-dark);
}
.skip:focus { top: 14px; }

.sidebar {
  width: 264px;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  padding: 24px 24px 20px;
  display: flex;
  flex-direction: column;
  overflow: auto;
  color: var(--ink);
  background: var(--paper);
  border-right: 1px solid var(--line);
  box-shadow: 10px 0 32px rgba(38, 36, 31, .035);
}

.sidebar-topline {
  position: absolute;
  inset: 0 0 auto;
  height: 7px;
  display: grid;
  grid-template-columns: 38% 29% 33%;
}
.sidebar-topline i:nth-child(1) { background: var(--burgundy); }
.sidebar-topline i:nth-child(2) { background: var(--gold); }
.sidebar-topline i:nth-child(3) { background: var(--cyan); }

.sidebar-actions { min-height: 35px; }
.logout { margin: 0; }
.text-button {
  min-height: 32px;
  padding: 3px 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  letter-spacing: .05em;
}
.text-button svg,
.mobile-toggle svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.text-button:hover { color: var(--burgundy); background: transparent; box-shadow: none; }

.brand {
  min-height: 104px;
  padding: 12px 8px 28px;
  display: flex;
  align-items: center;
  text-decoration: none;
  border-bottom: 1px solid var(--line-soft);
}
.brand img { max-width: 170px; max-height: 76px; object-fit: contain; object-position: left center; }
.brand-word { display: flex; flex-direction: column; font-weight: 800; font-size: 20px; line-height: .92; }
.brand-word strong:first-child { color: var(--burgundy); }
.brand-word strong:nth-child(2) { color: var(--gold); }
.brand-word small { margin-top: 5px; color: var(--navy); font-size: 12px; font-weight: 600; letter-spacing: .09em; }

.nav-caption {
  display: block;
  padding: 28px 10px 9px;
  color: #817b72;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .18em;
}

.sidebar nav a {
  position: relative;
  margin: 1px 0;
  padding: 10px 12px 10px 16px;
  display: block;
  color: #4d555c;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
  transition: color .16s ease, background-color .16s ease, transform .16s ease;
}
.sidebar nav a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 5px;
  height: 5px;
  background: transparent;
  transform: translateY(-50%) rotate(45deg);
}
.sidebar nav a:hover { color: var(--burgundy); background: #fbf6f6; transform: translateX(2px); }
.sidebar nav a[aria-current=page] { color: var(--burgundy); background: #f8eff1; }
.sidebar nav a[aria-current=page]::before { background: var(--gold); }
.sidebar nav a small { margin-top: 2px; color: #846b29; font-size: 11px; }

.sidebar-foot {
  margin-top: auto;
  padding: 24px 9px 3px;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}
.sidebar-foot small { margin-top: 4px; color: var(--burgundy); font-size: 9px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }

.workspace { min-height: 100vh; margin-left: 264px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  min-height: 82px;
  padding: 15px clamp(24px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: rgba(255, 253, 249, .82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.topbar > span { max-width: none; flex: 1 1 auto; min-width: 0; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; white-space: nowrap; }
.account { display: flex; align-items: center; gap: 12px; }
.account strong { display: block; font-size: 14px; }
.account small { font-size: 11px; }
.avatar {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--navy);
  border-radius: 50%;
  font-family: 'Newsreader', Georgia, serif;
  font-size: 18px;
  font-weight: 600;
}
.notification-link { margin-right: 15px; color: var(--navy); font-size: 12px; font-weight: 800; text-decoration: none; }
.notification-link b { margin-left: 5px; padding: 3px 7px; color: #fff; background: var(--burgundy); border-radius: 12px; }

main { width: 100%; max-width: 1560px; margin: auto; padding: clamp(42px, 5vw, 72px); }

.page-head {
  position: relative;
  margin: 0 0 44px;
  padding: 0 0 28px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  border-bottom: 1px solid var(--line);
}
.page-head::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 72px;
  height: 3px;
  background: var(--cyan);
}
.page-head > div { min-width: 0; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--burgundy);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .2em;
}

h1 {
  margin: 0 0 10px;
  color: var(--ink);
  font-family: 'Newsreader', Georgia, serif;
  font-size: clamp(38px, 4.4vw, 58px);
  font-weight: 600;
  line-height: .98;
  letter-spacing: -.035em;
}
h2 { margin: 0 0 18px; color: var(--navy); font-size: 20px; font-weight: 800; line-height: 1.3; }
h3 { margin: 0 0 10px; color: var(--ink); font-size: 16px; font-weight: 800; }
p { margin: 0 0 16px; }
.muted { color: var(--muted); }
small { display: block; color: var(--muted); font-size: 12px; }

.grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); gap: 30px; align-items: start; }
.grid.three { grid-template-columns: 1.2fr .9fr .9fr; }

.stats {
  margin-bottom: 30px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}
.stat {
  min-height: 132px;
  padding: 22px;
  position: relative;
  overflow: hidden;
  color: var(--ink);
  background: var(--paper);
  border: 0;
  border-top: 5px solid var(--cyan);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(38, 36, 31, .055);
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease;
}
.stat:nth-child(1), .stat:nth-child(4) { grid-column: span 2; }
.stat:nth-child(2), .stat:nth-child(3) { grid-column: span 1; }
.stat:nth-child(3n) { border-top-color: var(--burgundy); }
.stat:nth-child(4n) { border-top-color: var(--gold); }
.stat::after {
  content: '';
  position: absolute;
  right: -25px;
  bottom: -25px;
  width: 68px;
  height: 68px;
  border: 15px solid rgba(8, 168, 204, .07);
  border-radius: 50%;
}
.stat:hover { color: var(--ink); transform: translateY(-3px); box-shadow: 0 14px 34px rgba(38, 36, 31, .11); }
.stat span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.stat b { display: block; margin-top: 5px; color: var(--navy); font-family: 'Newsreader', Georgia, serif; font-size: 38px; line-height: 1; }

.panel {
  min-width: 0;
  margin-bottom: 36px;
  padding: clamp(22px, 2.5vw, 32px);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  box-shadow: 0 12px 34px rgba(38, 36, 31, .055);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.panel:nth-of-type(3n+1) { border-top: 3px solid var(--cyan); }
.panel-head { margin-bottom: 15px; display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.panel-head h2 { margin: 0; }
.panel-head a { font-size: 13px; font-weight: 800; }
.panel:hover { box-shadow: 0 16px 40px rgba(38, 36, 31, .075); }

.table-wrap { overflow: auto; margin-inline: -4px; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
th {
  padding: 12px 15px;
  color: #736d65;
  background: #f3f1ec;
  border-top: 3px solid var(--cyan);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
td { padding: 17px 15px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tbody tr { transition: background-color .15s ease; }
tbody tr:hover { background: #fcf8f5; }
tr:last-child td { border-bottom: 0; }
td a { font-weight: 800; text-decoration-color: rgba(157, 23, 55, .4); }
td small { margin-top: 4px; }

.badge {
  padding: 4px 8px;
  display: inline-block;
  color: var(--navy);
  background: #edf0f5;
  border-left: 3px solid #91a0b7;
  border-radius: 0;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.45;
  white-space: nowrap;
}
.badge.warning { color: #73520d; background: #fff5d9; border-left-color: var(--gold); }
.badge.alert { color: var(--burgundy-dark); background: #f9e9ed; border-left-color: var(--burgundy); }
.badge.good { color: var(--good); background: #e7f3ed; border-left-color: #4a9a74; }

.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.actions form { margin: 0; }
.empty { padding: 32px 12px; color: var(--muted); text-align: center; }

.task-card { position: relative; border-left: 6px solid var(--cyan); }
.task-card h2 { margin: 15px 0 10px; font-family: 'Newsreader', Georgia, serif; font-size: 28px; }
.task-card h2 a { color: var(--ink); text-decoration: none; }
.metadata { margin: 14px 0; display: flex; gap: 20px; flex-wrap: wrap; color: #4e5960; font-size: 13px; }

.notice {
  margin-bottom: 24px;
  padding: 18px 21px;
  color: #5c4814;
  background: #fff8df;
  border: 0;
  border-left: 5px solid var(--gold);
  border-radius: 10px;
  font-size: 14px;
}
.notice p:last-child { margin-bottom: 0; }

.details { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
.details > div { padding: 15px 0; border-bottom: 1px solid var(--line-soft); overflow-wrap: anywhere; }
.details dt { margin-bottom: 5px; color: #817b72; font-size: 10px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.details dd { margin: 0; }

.filters { margin-bottom: 24px; padding-bottom: 20px; display: flex; align-items: end; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line-soft); }
.filters .field { min-width: 150px; margin: 0; flex: 1; }
.field { margin-bottom: 19px; }
label { display: block; margin-bottom: 7px; color: #32393f; font-size: 12px; font-weight: 800; }
input:not([type=checkbox]), select, textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #c7c4bd;
  border-radius: 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:not([type=checkbox]):focus, select:focus, textarea:focus { border-color: var(--cyan-dark); outline: 0; box-shadow: 0 0 0 3px rgba(8, 168, 204, .13); }
input[type=checkbox] { width: 19px; height: 19px; accent-color: var(--burgundy); }
textarea { resize: vertical; }
.helptext, .help { margin-top: 5px; display: block; color: var(--muted); font-size: 12px; }
.errorlist { margin: 8px 0; padding: 0; color: var(--burgundy); font-size: 13px; list-style: none; }
.form-panel { max-width: 980px; }
.form-panel .form-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 26px; }
.form-panel .field:has(textarea) { grid-column: 1 / -1; }

.flash { margin-bottom: 22px; padding: 15px 18px; color: var(--good); background: #e8f4ee; border-left: 5px solid #4a9a74; }
.flash.error { color: var(--burgundy-dark); background: #f9e9ed; border-left-color: var(--burgundy); }

.instructions { line-height: 1.8; overflow-wrap: anywhere; }
.instructions li { padding: 3px 0 12px 8px; }
.prose { white-space: pre-wrap; }
.file-row { padding: 17px 0; display: flex; align-items: start; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line-soft); }
.file-row > div { min-width: 0; overflow-wrap: anywhere; }
.file-row p { margin: 4px 0; font-size: 14px; }
.file-row:last-child { border-bottom: 0; }

.comment { padding: 18px 0; border-bottom: 1px solid var(--line-soft); }
.comment p { margin: 9px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.comment-header span { color: var(--muted); font-size: 12px; }
.comment.private { padding: 17px; background: #fff8df; border-left: 4px solid var(--gold); }

.divider { height: 1px; margin: 25px 0; background: var(--line); }
.method-card { min-height: 142px; padding: 22px; background: #f5f3ef; border: 1px solid var(--line); }
.method-card.selected { background: #edf8fa; border: 1px solid #cfe7ec; border-top: 5px solid var(--cyan); }
.method-card h3 { margin-bottom: 17px; color: var(--navy); }
.method-card small { margin-top: 8px; }

.payment-panel {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #fffdf9 0%, #f5fbfc 100%);
  border-top-color: var(--cyan) !important;
}
.payment-panel::after {
  content: '';
  position: absolute;
  right: -42px;
  bottom: -42px;
  width: 130px;
  height: 130px;
  border: 26px solid rgba(8, 168, 204, .08);
  border-radius: 50%;
  pointer-events: none;
}
.payment-panel .panel-head { position: relative; z-index: 1; }
.payment-panel .muted { max-width: 650px; }
.payment-details { position: relative; z-index: 1; }
.payment-details > div { padding-right: 28px; }
.payment-details dd { color: var(--navy); font-weight: 700; }

.preview-bar { padding: 14px clamp(20px, 4vw, 55px); display: flex; justify-content: space-between; gap: 20px; color: #5d4610; background: #fff2c9; border-bottom: 2px solid var(--gold); }
.preview-bar a { font-weight: 800; }

.page-footer { margin: 0 clamp(24px, 4vw, 56px); padding: 23px 0; display: flex; justify-content: space-between; gap: 20px; color: #817b72; border-top: 1px solid var(--line); font-size: 9px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.guest { min-height: 100vh; }
.guest main { max-width: 600px; padding-top: 65px; }
.guest .panel { padding: 36px; border-top: 5px solid var(--cyan); }
.guest .page-footer { max-width: 536px; margin: auto; }

.mobile-toggle { display: none; }
.pagination { padding: 22px; display: flex; justify-content: center; gap: 20px; }
.history { font-size: 14px; }
.history summary { padding: 13px 0; color: var(--burgundy); font-weight: 800; cursor: pointer; }
.history pre { max-height: 300px; overflow: auto; font-size: 12px; }
.highlight { color: var(--burgundy); }
.token { padding: 20px; overflow-wrap: anywhere; background: #f1eee8; border-left: 5px solid var(--cyan); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.loading-indicator { display: none; }
body.busy .loading-indicator { display: block; }
a, button { touch-action: manipulation; }

@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(n) { grid-column: span 1; }
  .topbar > span { display: none; }
  .topbar { justify-content: flex-end; }
  .grid.three { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .sidebar { width: 232px; padding-inline: 18px; }
  .workspace { margin-left: 232px; }
  .grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .sidebar {
    width: 100%;
    position: static;
    padding: 18px 20px 15px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .sidebar-actions { grid-column: 2; grid-row: 1; min-height: 0; }
  .brand { grid-column: 1; grid-row: 1; min-height: 67px; padding: 5px 0; border: 0; }
  .brand img { max-width: 132px; max-height: 58px; }
  .brand-word { font-size: 16px; }
  .brand-word small { font-size: 10px; }
  .mobile-toggle {
    grid-column: 1 / -1;
    margin-top: 12px;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    color: #fff;
    background: var(--burgundy);
    border-color: var(--burgundy);
  }
  .sidebar nav { grid-column: 1 / -1; display: none; padding-top: 9px; }
  .sidebar nav.open { display: block; }
  .nav-caption { padding-top: 19px; }
  .sidebar-foot { display: none; }
  .workspace { margin: 0; }
  .topbar { min-height: 72px; padding: 14px 20px; }
  .account { width: 100%; justify-content: flex-end; }
  .notification-link { margin-right: auto; }
  .account strong { font-size: 13px; }
  .account small { font-size: 11px; }
  main { padding: 30px 20px; }
  .page-head { margin-bottom: 24px; flex-direction: column; gap: 14px; }
  h1 { font-size: 39px; }
  .stats { gap: 10px; }
  .stat { min-height: 112px; padding: 17px; }
  .stat b { font-size: 32px; }
  .grid, .grid.three, .details, .form-panel .form-fields { grid-template-columns: 1fr; }
  .panel { padding: 21px 18px; }
  .panel-head { flex-wrap: wrap; }
  .preview-bar { padding: 15px 20px; flex-direction: column; }
  .page-footer { margin: 0 20px; flex-direction: column; gap: 5px; }
  .file-row { flex-wrap: wrap; }
  .actions { align-items: stretch; }
  .metadata { gap: 10px 18px; }
  .filters .field { min-width: 100%; }
}

@media (prefers-reduced-motion: no-preference) {
  .page-head { animation: page-rise .45s both cubic-bezier(.2, .75, .25, 1); }
  .panel, .stat { animation: page-rise .5s .05s both cubic-bezier(.2, .75, .25, 1); }
  main > .stats .stat:nth-child(2), main > .grid > .panel:nth-child(2) { animation-delay: .1s; }
  main > .stats .stat:nth-child(3) { animation-delay: .15s; }
  main > .stats .stat:nth-child(4), main > .panel:nth-of-type(2) { animation-delay: .2s; }
  .sidebar nav a { transition: color .16s ease, background-color .16s ease, transform .16s ease, padding-left .16s ease; }
  .sidebar nav a:hover { padding-left: 20px; }
  .account, .topbar > span { animation: page-rise .42s both cubic-bezier(.2, .75, .25, 1); }
  @keyframes page-rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

/* Editorial content system */
.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;
}

.section-heading {
  margin-bottom: 28px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px;
}
.section-heading.compact { margin-bottom: 22px; }
.section-heading h2 { margin: 2px 0 0; font-size: clamp(20px, 2vw, 27px); }
.section-number {
  margin: 0;
  color: var(--burgundy);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .18em;
}
.section-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: var(--navy);
  background: #e8f7fa;
  border-radius: 50%;
}
.section-icon.warm { color: var(--burgundy); background: #fff4d6; }
.section-icon.dark { color: #fff; background: var(--navy); }
.section-icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* My Information */
.profile-record {
  position: relative;
  padding: clamp(28px, 4vw, 48px);
  overflow: hidden;
  border-top: 0 !important;
}
.profile-record::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(var(--cyan) 0 34%, var(--gold) 34% 68%, var(--burgundy) 68%);
}
.record-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 34px; }
.record-grid > div { min-height: 92px; padding: 20px 0; }
.record-grid > div:nth-child(4n+1) { grid-column: span 2; }
.record-grid dd { color: #30363c; font-size: 17px; }
.correction-panel {
  margin-left: clamp(0px, 5vw, 72px);
  padding: clamp(28px, 4vw, 44px);
  border-top: 3px solid var(--gold) !important;
}
.correction-panel > .muted { max-width: 560px; margin: -10px 0 28px 64px; }
.correction-panel form { max-width: 760px; }
.correction-history { max-width: 880px; }

/* Assignment brief */
.assignment-layout {
  margin-bottom: 36px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 30px;
  align-items: start;
}
.assignment-layout .panel { margin-bottom: 0; }
.assignment-brief {
  position: relative;
  min-height: 0;
  padding: clamp(30px, 4vw, 50px);
  border-top: 4px solid var(--cyan) !important;
  overflow: hidden;
  background: #eef7fa;
  border-radius: 14px;
  box-shadow: 0 18px 42px rgba(30, 42, 52, .1);
}
.assignment-brief::before { content: ''; position: absolute; right: -52px; bottom: -58px; width: 190px; height: 190px; border: 28px solid rgba(8,168,204,.1); border-radius: 50%; pointer-events: none; }
.assignment-brief::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 34%;
  height: 4px;
  background: var(--gold);
}
.assignment-brief > * { position: relative; z-index: 1; }
.assignment-brief .section-heading { margin: -4px -6px 26px; padding: 18px 18px 20px; background: rgba(255,255,255,.74); border-radius: 11px; }
.brief-update {
  margin: -12px 0 24px 64px;
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
}
.purpose-block {
  margin: 18px 0 20px clamp(0px, 4vw, 58px);
  padding: 18px 22px 20px;
  max-width: 700px;
  background: #fffdfa;
  color: var(--ink);
  border-left: 4px solid var(--cyan);
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(30,42,52,.06);
}
.purpose-block span {
  display: block;
  margin-bottom: 8px;
  color: var(--cyan-dark);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.purpose-block p { margin: 0; font-family: 'Newsreader', Georgia, serif; font-size: clamp(20px, 2vw, 27px); line-height: 1.2; }
.brief-description { max-width: 760px; margin: 0 0 30px clamp(0px, 4vw, 58px); padding: 21px 24px 22px; background: rgba(255,255,255,.78); border: 1px solid rgba(125,158,169,.25); border-radius: 10px; box-shadow: 0 10px 24px rgba(30,42,52,.045); }
.brief-description .brief-label { display: block; margin-bottom: 8px; color: var(--burgundy); font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.brief-description p { margin: 0; max-width: 64ch; color: #46515a; font-size: 16px; line-height: 1.65; }
.assignment-meta { margin-left: clamp(0px, 4vw, 58px); }
.assignment-meta > div { padding: 16px 14px; background: rgba(255,255,255,.58); border-bottom: 1px solid rgba(125,158,169,.22); }
.assignment-meta > div:nth-child(odd) { background: rgba(255,255,255,.34); }
.assignment-meta dd { color: #30363c; font-size: 16px; }
.instruction-panel {
  position: relative;
  padding: 30px;
  color: #eef2f7;
  background: var(--navy);
  border: 0;
  box-shadow: 0 18px 42px rgba(37, 55, 93, .2);
}
.instruction-panel h2, .instruction-panel h3 { color: #fff; }
.instruction-panel .section-number { color: var(--gold); }
.instruction-panel .section-icon.dark { color: var(--navy); background: #fff; }
.instruction-body { padding-top: 8px; line-height: 1.75; }
.instruction-body a { color: #fff; }
.instruction-body .instructions li { border-bottom: 1px solid rgba(255,255,255,.12); }
.instruction-action { margin-top: 25px; }
.instruction-panel button { width: 100%; color: var(--ink); background: var(--gold); border-color: var(--gold); }

/* Funding and payment */
.funding-notice { max-width: 820px; margin-left: clamp(0px, 5vw, 68px); }
.method-selector {
  margin: 30px 0 46px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.method-card {
  min-height: 150px;
  padding: 22px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-content: center;
  gap: 14px;
  background: rgba(255,253,249,.68);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: transform .14s ease, box-shadow .14s ease, background-color .14s ease;
}
.method-card:first-child { grid-row: auto; }
.method-card.selected {
  background: var(--navy);
  color: #fff;
  border: 1px solid var(--navy);
  border-left: 5px solid var(--gold);
}
.method-card:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(37,55,93,.12); }
.method-card h3 { margin: 0; color: var(--navy); font-size: 15px; }
.method-card.selected h3 { color: #fff; }
.method-card small { margin: 3px 0 0; }
.method-card.selected small { color: #bec7d8; }
.method-index { color: #9b958d; font-family: 'Newsreader', Georgia, serif; font-size: 20px; }
.method-card.selected .method-index { color: var(--gold); }
.method-card > .badge { grid-column: 2; justify-self: start; }
.funding-brief { padding: clamp(30px, 4vw, 48px); border-top: 0 !important; }
.funding-brief-head {
  margin-bottom: 30px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 24px;
}
.funding-brief-head h2 { margin: 3px 0 7px; font-family: 'Newsreader', Georgia, serif; font-size: clamp(30px, 3vw, 43px); font-weight: 600; }
.funding-manager { margin: 0; color: var(--muted); font-size: 13px; }
.funding-brief-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(270px, .7fr); gap: clamp(28px, 5vw, 70px); }
.funding-instructions { padding-top: 8px; }
.funding-instructions > h3 { margin-bottom: 22px; color: var(--burgundy); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; }
.funding-summary {
  margin-top: 5px;
  padding: 27px;
  align-self: start;
  background: #f1f7f8;
  border-top: 4px solid var(--cyan);
}
.funding-label { margin: 0; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.funding-amount { margin: 8px 0 4px; display: block; color: var(--navy); font-family: 'Newsreader', Georgia, serif; font-size: clamp(34px, 4vw, 48px); font-weight: 600; line-height: 1; }
.funding-amount span { font-family: 'Nunito Sans', sans-serif; font-size: 11px; letter-spacing: .12em; }
.funding-summary > small { margin-bottom: 22px; }
.funding-field { padding: 16px 0 0; border-top: 1px solid #d7e5e8; }
.funding-field span { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.funding-field p { margin: 5px 0 0; }
.funding-documents { max-width: 900px; margin-left: clamp(0px, 4vw, 58px); }

/* Manager chat */
.chat-launcher {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 32;
  min-height: 54px;
  padding: 13px 18px;
  border: 0;
  border-radius: 28px;
  color: #fff;
  background: var(--burgundy);
  box-shadow: 0 14px 34px rgba(84, 14, 37, .28);
}
.chat-launcher svg, .chat-close svg, .chat-send svg, .chat-empty svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chat-launcher:hover { box-shadow: 0 18px 38px rgba(84, 14, 37, .34); }
.chat-backdrop {
  position: fixed;
  inset: 0;
  z-index: 38;
  visibility: hidden;
  background: rgba(24, 29, 35, .34);
  opacity: 0;
  backdrop-filter: blur(2px);
  transition: opacity .22s ease, visibility .22s ease;
}
body.chat-open .chat-backdrop { visibility: visible; opacity: 1; }
.chat-drawer {
  width: min(460px, calc(100vw - 28px));
  height: min(720px, calc(100vh - 42px));
  position: fixed;
  z-index: 40;
  right: 18px;
  bottom: 18px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  background: #f7f6f3;
  border: 1px solid #d8d4cd;
  border-radius: 14px;
  box-shadow: 0 28px 80px rgba(25, 28, 36, .3);
  opacity: 0;
  transform: translateY(8px) scale(.995);
  visibility: hidden;
  transition: opacity .22s ease, transform .22s ease, visibility .22s ease;
}
.chat-drawer.is-open { opacity: 1; transform: none; visibility: visible; }
.chat-drawer-head {
  padding: 21px 22px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 12px;
  color: #fff;
  background: var(--navy);
}
.chat-drawer-head h2 { margin: 0; color: #fff; font-family: 'Newsreader', Georgia, serif; font-size: 26px; font-weight: 600; }
.chat-drawer-head small { color: #c7d0de; }
.chat-kicker { margin: 0; color: var(--gold); font-size: 8px; font-weight: 800; letter-spacing: .16em; }
.chat-presence { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.25); border-radius: 50%; }
.chat-presence span { width: 8px; height: 8px; background: #70cf9b; border-radius: 50%; box-shadow: 0 0 0 4px rgba(112,207,155,.13); }
.chat-close { width: 36px; min-height: 36px; padding: 7px; color: #fff; background: transparent; border: 0; border-radius: 50%; }
.chat-close:hover { background: rgba(255,255,255,.12); box-shadow: none; transform: none; }
.chat-thread { padding: 22px 18px; overflow-y: auto; overscroll-behavior: contain; }
.chat-message { margin-bottom: 18px; display: flex; align-items: end; gap: 9px; }
.chat-message.mine { flex-direction: row-reverse; }
.chat-avatar { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; color: #fff; background: #77839c; border-radius: 50%; font-size: 11px; font-weight: 800; }
.chat-message.mine .chat-avatar { background: var(--burgundy); }
.chat-bubble { max-width: 79%; padding: 12px 14px 10px; background: #fff; border-radius: 14px 14px 14px 3px; box-shadow: 0 4px 14px rgba(34, 38, 44, .07); }
.chat-message.mine .chat-bubble { color: #fff; background: var(--burgundy); border-radius: 14px 14px 3px 14px; }
.chat-message.private .chat-bubble { color: var(--ink); background: #fff5d9; border: 1px solid #f0d589; }
.chat-meta { margin-bottom: 4px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 10px; }
.chat-meta time { color: var(--muted); white-space: nowrap; }
.chat-message.mine .chat-meta time, .chat-message.mine .chat-delivery { color: #f1bdca; }
.chat-message.private .chat-meta time { color: var(--muted); }
.chat-bubble p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.5; }
.chat-delivery { margin-top: 4px; text-align: right; font-size: 9px; }
.chat-note-label { display: inline-block; margin-bottom: 7px; color: #725315; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.chat-empty { height: 100%; min-height: 240px; display: grid; place-content: center; justify-items: center; color: var(--muted); text-align: center; }
.chat-empty svg { width: 38px; height: 38px; margin-bottom: 13px; color: var(--cyan-dark); }
.chat-composer { padding: 14px 16px 16px; background: #fff; border-top: 1px solid var(--line); }
.chat-composer textarea { min-height: 72px; padding: 12px 13px; background: #fbfaf8; border: 1px solid #d5d1c9; border-radius: 12px; }
.chat-actions { margin-top: 9px; display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.chat-private { margin: 0 auto 0 2px; display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.chat-private input { width: 16px; height: 16px; }
.chat-send { min-height: 38px; padding: 8px 13px; border-radius: 20px; }
.chat-send svg { width: 17px; height: 17px; }

@media (max-width: 980px) {
  .record-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .record-grid > div:nth-child(4n+1) { grid-column: auto; }
  .assignment-layout, .funding-brief-grid { grid-template-columns: 1fr; }
  .instruction-panel { position: static; }
  .method-selector { grid-template-columns: 1fr; }
  .method-card:first-child { grid-row: auto; }
}

@media (max-width: 700px) {
  .section-heading { grid-template-columns: 42px minmax(0, 1fr); gap: 12px; }
  .section-heading > .badge { grid-column: 2; justify-self: start; }
  .section-icon { width: 42px; height: 42px; }
  .record-grid { grid-template-columns: 1fr; }
  .record-grid > div { min-height: 0; }
  .correction-panel, .funding-notice, .funding-documents { margin-left: 0; }
  .correction-panel > .muted { margin-left: 0; }
  .assignment-brief, .funding-brief { padding: 25px 19px; }
  .brief-update, .purpose-block, .brief-description, .assignment-meta { margin-left: 0; }
  .purpose-block { padding: 22px; box-shadow: -6px 6px 0 #e6f5f8; }
  .assignment-brief::after { right: 18px; height: 52px; }
  .instruction-panel { padding: 25px 20px; }
  .method-card { grid-template-columns: 30px minmax(0, 1fr); }
  .method-card > .badge { grid-column: 2; justify-self: start; }
  .funding-brief-head { flex-direction: column; }
  .funding-summary { padding: 22px; }
  .chat-launcher { right: 18px; bottom: 18px; min-height: 50px; }
  .chat-launcher span { display: none; }
  .chat-drawer { width: 100%; height: min(760px, calc(100vh - 12px)); right: 0; bottom: 0; border: 0; }
  .chat-drawer-head { padding: 18px; }
}

@media (prefers-reduced-motion: no-preference) {
  .assignment-brief .purpose-block, .funding-summary, .profile-record .record-grid {
    animation: detail-reveal .55s .12s both cubic-bezier(.2,.75,.25,1);
  }
  @keyframes detail-reveal {
    from { opacity: 0; }
    to { opacity: 1; }
  }
}

.danger-zone {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid #ead4da;
}
.danger-zone summary { color: var(--burgundy-dark); }
.danger-zone form { margin-top: 18px; }
.danger-zone button { margin-top: 12px; }

@media (prefers-reduced-motion: no-preference) {
  @keyframes page-rise {
    from { opacity: 0; transform: none; }
    to { opacity: 1; transform: none; }
  }
}
