/* Electron Tracker. Layout and components follow the Plexus Tools guidelines (Rev A).
   Colours and type from the Electron Education design system. */

@font-face { font-family: "Montserrat"; font-weight: 400; font-display: swap; src: url("vendor/fonts/montserrat-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 600; font-display: swap; src: url("vendor/fonts/montserrat-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 700; font-display: swap; src: url("vendor/fonts/montserrat-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 800; font-display: swap; src: url("vendor/fonts/montserrat-latin-800-normal.woff2") format("woff2"); }

:root {
  --cta: #fb3d2a; --cta-hover: #e0301f; --ink: #191a1f; --ink2: #232030; --gold: #d1b657; --gold-text: #8a6a09; --saffron: #e6be32;
  --bg: #f0f0f0; --card: #ffffff; --line: #dedbd3; --text: #191a1f; --muted: #5e5b68;
  --err: #b3261e; --warn: #9a6200; --info: #45526b; --ok: #2e7d32;
  --ok-tint: #e6f4e8; --warn-tint: #fdf3dc; --err-tint: #fdecea; --gold-tint: #f7efd2;
  --override: #fbf3da; --missing: #fff6c2; --flags: #fbf6e6; --row-hover: #f7f6f2;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Montserrat", "Segoe UI", Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 13.5px; }
button, input, select, textarea { font-family: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

header { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--ink); color: #fff; padding: 10px 22px; border-bottom: 3px solid var(--gold); }
.brand { font-size: 22px; font-weight: 700; letter-spacing: .5px; }
.brand span { color: var(--gold); }
.brand small { font-weight: 400; font-size: 12px; opacity: .75; margin-left: 10px; letter-spacing: 0; }
.proj-bar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.proj-bar label { flex-direction: row; align-items: center; gap: 8px; color: #cfcbd8; font-size: 12.5px; }
.proj-bar select { min-width: 200px; padding: 7px; border-radius: 6px; border: none; font-size: 13.5px; }
.proj-bar .mode { font-size: 12px; color: #cfcbd8; }

.flags-bar { padding: 8px 22px; background: var(--flags); border-bottom: 1px solid var(--line);
  font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.flags-bar .f-error { color: var(--err); font-weight: 600; }
.flags-bar .f-warning { color: var(--warn); }
.flags-bar .f-info { color: var(--info); }
th.sort { cursor: pointer; user-select: none; white-space: nowrap; }
th.sort:hover { background: var(--ink); }
th.sort .dir { display: inline-block; width: 12px; margin-left: 4px; color: var(--gold); }
.filters { display: flex; gap: 10px 14px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.filters label { min-width: 160px; }
.filters .grow { flex: 1; min-width: 200px; }

.layout { display: flex; min-height: calc(100vh - 57px); }
nav { width: var(--nav-w, 230px); flex: none; background: #fff; border-right: 1px solid var(--line); padding: 0 0 14px; }
nav .context { padding: 14px 18px 16px; margin-bottom: 8px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
nav .context select { width: 100%; }
nav .context select:disabled { color: var(--muted); background: var(--bg); }
.resizer { flex: none; width: 6px; margin-left: -3px; margin-right: -3px; cursor: col-resize; position: relative; z-index: 2; }
.resizer:hover, .resizer.dragging, .resizer:focus-visible { background: var(--gold); outline: none; }
body.resizing { cursor: col-resize; user-select: none; }
nav button { display: block; width: 100%; text-align: left; padding: 11px 18px; border: none;
  background: none; font-size: 13.5px; cursor: pointer; color: var(--text); }
nav button:hover { background: var(--bg); }
nav button.active { background: var(--bg); font-weight: 600; }

main { flex: 1; min-width: 0; padding: 20px 28px 60px; max-width: 1150px; }
h2 { color: var(--ink); font-size: 18px; font-weight: 700; margin: 22px 0 10px; }
h2:first-child { margin-top: 4px; }
h3 { color: var(--ink); font-size: 15px; font-weight: 700; margin: 20px 0 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 14px; }
.card h3:first-child { margin-top: 0; }
.hint { font-size: 13px; color: var(--muted); margin: 2px 0 12px; line-height: 1.5; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin-bottom: 12px; }
label { display: flex; flex-direction: column; font-size: 12.5px; color: #445; gap: 4px; }
input, select, textarea { padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font-size: 13.5px; color: var(--text); background: #fff; }
textarea { min-height: 64px; resize: vertical; line-height: 1.45; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

.btn { padding: 8px 14px; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; font-size: 13.5px; color: var(--text); }
.btn:hover { border-color: var(--ink2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--cta); border-color: var(--cta); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--cta-hover); border-color: var(--cta-hover); }
.btn.big { font-size: 15px; padding: 11px 22px; }
.btn.danger { color: var(--err); }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn.icon { width: 30px; height: 30px; padding: 0; display: inline-grid; place-items: center; color: var(--muted); }
.btn.icon:hover { color: var(--err); border-color: var(--err); }

table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th { background: var(--ink2); color: #fff; text-align: left; padding: 7px 10px; font-weight: 600; }
td { padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:hover td { background: var(--row-hover); }
td input[type=text], td select { width: 100%; }
.cell-link { padding: 3px 4px; }
.cell-link button { width: 100%; border: 1px solid transparent; background: none; border-radius: 6px; padding: 5px 4px; cursor: pointer; }
.cell-link button:hover { border-color: var(--ink2); background: var(--row-hover); }
.cell-link button:hover .badge { text-decoration: underline; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.ctr { text-align: center; }
.scroll { overflow-x: auto; }
.code { font-weight: 600; white-space: nowrap; color: var(--gold-text); }
.override { background: var(--override); }
.missing { background: var(--missing); }
.muted { color: var(--muted); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-tint); color: var(--ok); }
.badge.warn { background: var(--warn-tint); color: var(--warn); }
.badge.err { background: var(--err-tint); color: var(--err); }
.badge.rec { background: var(--ink2); color: #fff; }
.badge.gold { background: var(--gold-tint); color: var(--gold-text); }
.badge.none { background: var(--bg); color: var(--muted); }

.totals { display: flex; gap: 26px; flex-wrap: wrap; margin: 10px 0; }
.totals .kpi { background: var(--bg); border-radius: 8px; padding: 10px 16px; }
.totals .kpi b { display: block; font-size: 19px; color: var(--ink); font-variant-numeric: tabular-nums; }
.totals .kpi span { font-size: 12px; color: #667; }

.hidden { display: none !important; }

/* collapsible class cards on Classes and Students */
.class-card { padding: 0; overflow: hidden; }
.class-card.open { border-left: 3px solid var(--gold); }
.class-head { display: flex; align-items: center; gap: 2px; padding: 4px 12px 4px 4px; }
.class-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; background: none; border: none;
  cursor: pointer; text-align: left; padding: 11px 12px; border-radius: 6px; color: var(--text); font-size: 13.5px; }
.class-toggle:hover { background: var(--row-hover); }
.class-toggle .class-name { font-weight: 600; font-size: 14.5px; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.class-toggle .caret { flex: none; width: 7px; height: 7px; border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted); transform: rotate(-45deg); margin-left: 4px; transition: transform .12s; }
.class-card.open .class-toggle .caret { transform: rotate(45deg); }
.grip { flex: none; display: grid; place-items: center; width: 26px; height: 32px; margin-left: 4px;
  border: none; background: none; padding: 0; color: #a7a39b; cursor: grab; border-radius: 5px; touch-action: none; }
.grip:hover { color: var(--ink2); background: var(--row-hover); }
.grip:active { cursor: grabbing; }
.class-card.dragging { opacity: .45; }
.class-card.drop-above { box-shadow: inset 0 3px 0 var(--cta); }
.class-card.drop-below { box-shadow: inset 0 -3px 0 var(--cta); }
.class-card.open.drop-above, .class-card.open.drop-below { border-left-color: var(--gold); }
.class-body { padding: 4px 16px 16px; border-top: 1px solid var(--line); }

/* login page */
.login-page .login-main { max-width: 440px; margin: 0 auto; padding: 60px 20px; }
.login-card { padding: 24px 26px 22px; }
.login-card h2 { margin: 0 0 6px; }
.login-card label { margin-bottom: 14px; }
.login-card input[type=password] { font-size: 15px; padding: 9px 10px; }
.login-card .btn.primary { width: 100%; }
.login-error { background: var(--err-tint); color: var(--err); border-radius: 6px;
  padding: 9px 12px; font-size: 13px; font-weight: 600; margin: 0 0 12px; }
.hidden-field { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.signout { background: none; border: 1px solid rgba(240,240,240,.35); color: #e8e6ef;
  border-radius: 6px; padding: 5px 12px; font-size: 12.5px; cursor: pointer; }
.signout:hover { border-color: var(--gold); color: var(--gold); }

.toast { position: fixed; bottom: 24px; right: 24px; background: var(--ink2); color: #fff; max-width: 420px;
  padding: 12px 20px; border-radius: 8px; font-size: 14px; box-shadow: 0 4px 18px rgba(0,0,0,.25); z-index: 50; }
.toast.error { background: var(--err); }

/* ---- Electron Tracker components ---- */

/* student panels on End of class */
.student { background: var(--card); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; }
.student.open { border-left: 3px solid var(--gold); }
.student-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 11px 16px; border: none; background: none;
  cursor: pointer; text-align: left; font-size: 13.5px; color: var(--text); border-radius: 8px; }
.student-head:hover { background: var(--row-hover); }
.student-head .name { font-weight: 600; font-size: 14px; flex: 1; }
.student-head .caret { width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin: 0 4px 3px; }
.student.open .caret { transform: rotate(-135deg); margin-bottom: -3px; }
.student-body { padding: 4px 16px 16px; border-top: 1px solid var(--line); }
.student-body .about { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: none; background: #fff; padding: 7px 18px; font-size: 13.5px; cursor: pointer; color: var(--text); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on-ok { background: var(--ok-tint); color: var(--ok); font-weight: 600; }
.seg button.on-err { background: var(--err-tint); color: var(--err); font-weight: 600; }

.goals td:first-child { width: 42px; }
.goals input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--ink2); margin: 0; cursor: pointer; }
.goals label { flex-direction: row; align-items: center; gap: 10px; font-size: 13.5px; color: var(--text); cursor: pointer; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 4px 10px; font-size: 12.5px; cursor: pointer; color: var(--text); }
.chip.pos[aria-pressed="true"] { background: var(--ok-tint); border-color: var(--ok); color: var(--ok); font-weight: 600; }
.chip.con[aria-pressed="true"] { background: var(--err-tint); border-color: var(--err); color: var(--err); font-weight: 600; }
.field-title { font-size: 12.5px; color: #445; margin: 14px 0 6px; }

/* pre-class report */
.report-student { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.report-student:last-child { border-bottom: none; }
.report-student h3 { margin: 0; font-size: 14px; }
.report-student ul { margin: 6px 0 0; padding-left: 20px; line-height: 1.5; }
.report-student li { margin: 2px 0; }
.source { font-size: 12.5px; color: var(--muted); }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(25,26,31,.45); z-index: 40; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--card); border-radius: 8px; border-top: 3px solid var(--gold); padding: 18px 20px; width: min(420px, 100%); box-shadow: 0 8px 30px rgba(0,0,0,.25); }
.modal h3 { margin: 0 0 6px; }
.modal p { margin: 0 0 16px; color: var(--muted); line-height: 1.5; }
.modal .row { justify-content: flex-end; }

@media (max-width: 860px) {
  .layout { flex-direction: column; }
  nav { width: auto !important; display: flex; flex-wrap: wrap; padding: 0; border-right: none; border-bottom: 1px solid var(--line); }
  nav .context { width: 100%; flex-direction: row; margin: 0; }
  .resizer { display: none; }
  nav .context label { flex: 1; }
  nav button { white-space: nowrap; }
  main { padding: 16px 14px 60px; }
  .grid2 { grid-template-columns: 1fr; }
}

@media print {
  header, nav, .flags-bar, .no-print { display: none !important; }
  main { padding: 0; max-width: none; }
  .card { border: none; padding: 0; }
}
