:root {
  --navy: #102a43;
  --navy-2: #183b56;
  --blue: #0f6cbd;
  --blue-light: #eaf4ff;
  --teal: #0f7b6c;
  --gold: #b98213;
  --red: #b42318;
  --orange: #b54708;
  --green: #067647;
  --ink: #182230;
  --muted: #667085;
  --line: #d0d5dd;
  --surface: #ffffff;
  --bg: #f5f7fa;
  --shadow: 0 8px 24px rgba(16,42,67,.08);
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Inter, "Segoe UI", Arial, sans-serif; color: var(--ink); background: var(--bg); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
#app { min-height: 100vh; display: grid; grid-template-columns: 244px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; color: white; background: linear-gradient(180deg, var(--navy), #0b2239); padding: 22px 16px; display: flex; flex-direction: column; z-index: 20; }
.brand { display: flex; gap: 12px; align-items: center; padding: 0 6px 22px; }
.brand-mark { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; letter-spacing: -.04em; color: var(--navy); background: linear-gradient(145deg,#fff,#cfe7ff); }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 16px; }
.brand span { margin-top: 2px; font-size: 12px; color: #b9d3e8; }
#nav { display: grid; gap: 4px; }
.nav-button { display: flex; align-items: center; width: 100%; gap: 10px; border: 0; border-radius: 9px; padding: 10px 12px; text-align: left; color: #dbe8f3; background: transparent; }
.nav-button:hover, .nav-button.active { color: white; background: rgba(255,255,255,.11); }
.nav-button .nav-icon { width: 22px; text-align: center; opacity: .95; }
.nav-section { padding: 17px 12px 6px; font-size: 10px; font-weight: 800; color: #8fb3ce; letter-spacing: .11em; text-transform: uppercase; }
.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,.15); padding: 16px 6px 0; }
.sidebar-footer label { display: block; font-size: 11px; font-weight: 700; color: #b9d3e8; text-transform: uppercase; letter-spacing: .06em; }
.sidebar-footer select { width: 100%; margin-top: 7px; border: 1px solid rgba(255,255,255,.2); border-radius: 8px; padding: 9px; color: white; background: rgba(255,255,255,.1); }
.sidebar-footer select option { color: var(--ink); }
.storage-note { margin-top: 9px; font-size: 11px; line-height: 1.4; color: #8fb3ce; }
.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 15; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 18px 28px; border-bottom: 1px solid #e4e7ec; background: rgba(255,255,255,.95); backdrop-filter: blur(8px); }
.topbar h1 { margin: 2px 0 0; font-size: 25px; line-height: 1.2; }
.eyebrow { margin: 0; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: flex-end; gap: 10px; }
.class-picker { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.class-picker select { display: block; min-width: 240px; margin-top: 5px; border: 1px solid var(--line); border-radius: 8px; padding: 9px 34px 9px 10px; color: var(--ink); background: white; }
.content { padding: 26px 28px 48px; max-width: 1500px; margin: 0 auto; }
.notice { margin: 14px 28px 0; padding: 12px 16px; border: 1px solid #b2ddff; border-radius: 9px; color: #175cd3; background: #eff8ff; }
.notice.error { color: var(--red); border-color: #fecdca; background: #fef3f2; }
.notice.success { color: var(--green); border-color: #abefc6; background: #ecfdf3; }
.hidden { display: none !important; }
.button { border: 1px solid var(--line); border-radius: 8px; padding: 9px 13px; font-weight: 650; color: #344054; background: white; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.button:hover { background: #f9fafb; }
.button.primary { color: white; border-color: var(--blue); background: var(--blue); }
.button.primary:hover { background: #0b5ea8; }
.button.danger { color: var(--red); border-color: #fda29b; background: #fff; }
.button.small { padding: 6px 9px; font-size: 12px; }
.button.link { padding: 0; border: 0; color: var(--blue); background: transparent; box-shadow: none; }
.icon-button { border: 0; border-radius: 7px; padding: 6px 9px; color: #475467; background: transparent; font-size: 22px; }
.grid { display: grid; gap: 18px; }
.grid.kpis { grid-template-columns: repeat(4,minmax(160px,1fr)); }
.grid.two { grid-template-columns: repeat(2,minmax(0,1fr)); }
.grid.three { grid-template-columns: repeat(3,minmax(0,1fr)); }
.card { border: 1px solid #e4e7ec; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.card-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid #eaecf0; }
.card-header h2, .card-header h3 { margin: 0; font-size: 16px; }
.card-body { padding: 18px; }
.kpi { padding: 18px; }
.kpi .label { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.kpi .value { margin-top: 8px; color: var(--navy); font-size: 31px; font-weight: 780; letter-spacing: -.03em; }
.kpi .detail { margin-top: 5px; color: var(--muted); font-size: 12px; }
.stack { display: grid; gap: 18px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; }
.toolbar.compact { margin-bottom: 0; align-items: center; }
.toolbar .spacer { flex: 1; }
.field { display: grid; gap: 6px; min-width: 150px; }
.field label { font-size: 12px; font-weight: 700; color: #475467; }
.field input, .field select, .field textarea, input.input, select.input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; color: var(--ink); background: white; }
.field input:focus, .field select:focus, .field textarea:focus, input.input:focus, select.input:focus { outline: 3px solid #d1e9ff; border-color: var(--blue); }
.field .hint { font-size: 11px; color: var(--muted); }
.inline-field { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; align-items: center; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.table-wrap { overflow: auto; border: 1px solid #eaecf0; border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { position: sticky; top: 0; z-index: 2; padding: 10px 12px; color: #475467; background: #f8fafc; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
td { padding: 11px 12px; border-top: 1px solid #eaecf0; vertical-align: middle; }
tr:hover td { background: #fbfdff; }
.text-right { text-align: right; }
.muted { color: var(--muted); }
.badge { display: inline-flex; align-items: center; white-space: nowrap; border-radius: 999px; padding: 4px 8px; font-size: 11px; font-weight: 750; color: #344054; background: #f2f4f7; }
.badge.good { color: var(--green); background: #ecfdf3; }
.badge.warn { color: var(--orange); background: #fffaeb; }
.badge.risk { color: var(--red); background: #fef3f2; }
.badge.info { color: #175cd3; background: #eff8ff; }
.progress { height: 8px; overflow: hidden; border-radius: 999px; background: #eaecf0; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--blue); }
.grade-value { font-weight: 780; font-variant-numeric: tabular-nums; }
.mark-input { width: 82px; border: 1px solid var(--line); border-radius: 7px; padding: 7px 8px; text-align: right; }
.status-select { min-width: 118px; border: 1px solid var(--line); border-radius: 7px; padding: 7px 8px; }
.locked-banner { display: flex; gap: 10px; align-items: center; padding: 12px 14px; margin-bottom: 16px; border: 1px solid #fedf89; border-radius: 9px; color: #93370d; background: #fffaeb; }
.terminology { border-color: #b2ddff; background: #f5fbff; box-shadow: none; }
.terminology b { color: #175cd3; }
.problem-list { display: grid; gap: 10px; margin: 16px 0; padding-left: 22px; }
.problem-list li { padding-left: 4px; color: #7a271a; line-height: 1.45; }
.weight-row { display: grid; grid-template-columns: 1fr 110px 40px; align-items: center; gap: 8px; margin: 9px 0; }
.weight-total { display: flex; justify-content: space-between; margin-top: 12px; padding-top: 12px; border-top: 1px solid #eaecf0; font-weight: 800; }
.class-card { display: flex; justify-content: space-between; gap: 16px; padding: 18px; }
.class-card h3 { margin: 0 0 6px; }
.class-card p { margin: 3px 0; color: var(--muted); font-size: 13px; }
.empty-state { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty-state h3 { color: var(--ink); margin: 10px 0 5px; }
.empty-icon { width: 44px; height: 44px; display: grid; place-items: center; margin: auto; border-radius: 50%; color: var(--green); background: #ecfdf3; font-size: 22px; }
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(16,24,40,.5); }
.modal-card { width: min(720px,100%); max-height: 92vh; overflow: auto; border-radius: 14px; background: white; box-shadow: 0 24px 60px rgba(16,24,40,.24); }
.modal-header { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid #eaecf0; background: white; }
.modal-header h2 { margin: 0; font-size: 19px; }
.modal-body { padding: 18px; }
.transcript-shell { max-width: 850px; margin: 0 auto; }
.transcript-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.transcript { position: relative; min-height: 1030px; padding: 38px 42px 26px; border: 1px solid #98a2b3; background: white; color: #111; font-family: Georgia, "Times New Roman", serif; box-shadow: var(--shadow); }
.transcript.draft::before { content: "DRAFT - NOT FINAL"; position: absolute; inset: 48% auto auto 17%; transform: rotate(-28deg); font: 800 54px/1 Arial,sans-serif; color: rgba(180,35,24,.10); letter-spacing: .06em; pointer-events: none; }
.transcript-brand { display: flex; justify-content: space-between; align-items: end; padding-bottom: 9px; border-bottom: 2px solid #222; }
.transcript-brand .logo-text { color: #bd2b2b; font: 800 23px/1 Arial,sans-serif; }
.transcript-brand .address { font: 13px/1.2 Arial,sans-serif; letter-spacing: .06em; }
.transcript-title { text-align: center; padding: 8px 0 5px; }
.transcript-title h2 { margin: 0; font-size: 18px; font-style: italic; }
.transcript-title p { margin: 2px 0; font-weight: 700; }
.transcript-title .student { font-size: 19px; letter-spacing: .16em; text-transform: uppercase; }
.transcript table { border: 1.5px solid #111; font-size: 12px; }
.transcript td, .transcript th { border: 1px solid #333; padding: 4px 8px; font-family: Georgia, "Times New Roman", serif; }
.transcript .section-row td { color: white; background: #176f9f; text-align: center; font-weight: 800; }
.transcript .mark-cell { width: 22%; text-align: center; font-weight: 700; }
.transcript .summary-row td { color: white; background: #176f9f; font-weight: 800; }
.transcript .recognition { margin: 11px 0 26px; text-align: center; color: #bb8b2a; font-weight: 800; letter-spacing: .16em; font-size: 18px; }
.signature-row { display: grid; grid-template-columns: 1fr 1fr; gap: 90px; margin: 48px 10px 14px; }
.signature-line { border-top: 1px solid #111; padding-top: 4px; font-size: 11px; }
.scale-table { width: 88% !important; margin: 8px auto 0; }
.scale-table td, .scale-table th { padding: 3px 8px; font-size: 10px; }
.audit-list { display: grid; gap: 10px; }
.audit-item { display: grid; grid-template-columns: 155px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid #eaecf0; font-size: 12px; }
.mobile-only { display: none; }
@media (max-width: 980px) {
  #app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -260px; transition: left .2s; width: 244px; }
  .sidebar.open { left: 0; }
  .mobile-only { display: inline-block; }
  .grid.kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .grid.three { grid-template-columns: 1fr; }
  .topbar { padding: 14px 18px; }
  .content { padding: 20px 18px 42px; }
  .class-picker select { min-width: 170px; }
}
@media (max-width: 680px) {
  .topbar { align-items: flex-start; }
  .topbar-actions { display: grid; }
  .grid.kpis, .grid.two, .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .transcript { padding: 20px 14px; }
  .transcript-brand { display: block; }
  .transcript-brand .address { margin-top: 8px; }
}
@media print {
  body { background: white; }
  #app, .modal, .transcript-toolbar { display: none !important; }
  body.printing-transcript #printArea { display: block !important; }
  #printArea { position: absolute; inset: 0; margin: 0; }
  .transcript { min-height: 0; border: 0; box-shadow: none; padding: .2in .25in; }
  .transcript.draft::before { color: rgba(180,35,24,.12); }
  @page { size: letter; margin: .3in; }
}


/* Hosted sign-in and shared-data status */
.login-screen { min-height:100vh; display:grid; place-items:center; padding:24px; background:linear-gradient(145deg,#edf5fb,#f8fafc 55%,#e8f3ee); }
.login-screen.hidden { display:none; }
.login-card { width:min(420px,100%); background:#fff; border:1px solid var(--border); border-radius:18px; box-shadow:var(--shadow); padding:32px; display:grid; gap:16px; }
.login-card h1 { margin:0; }
.login-card p { margin:0; color:var(--muted); }
.login-card label { display:grid; gap:6px; font-weight:700; }
.login-card input { width:100%; border:1px solid var(--border); border-radius:8px; padding:11px 12px; font:inherit; }
.login-error { min-height:20px; color:var(--red) !important; font-weight:700; }
.hosted-only { display:none; }
html.hosted .hosted-only { display:inline-flex; }
