/* Compass — a Grain Coast managed solution. Same family as Beacon: Inter, ink, warm accents. */
:root {
  --accent: #145C8C;
  --accent-dark: #0E4568;
  --accent-soft: #EAF2F8;
  --orange: #E8650A;
  --orange-soft: #FDF4EC;
  --ink: #1A1D24;
  --ink-soft: #2E323C;
  --grey-700: #4A4F5C;
  --grey-500: #7A8090;
  --grey-300: #C8CCD4;
  --grey-100: #ECEEF2;
  --grey-50: #F7F8FA;
  --bg: #FAFAF8;
  --white: #fff;
  --border: #E5E7ED;
  --green: #1E7B3A;
  --green-soft: #E5F4E4;
  --red: #B42318;
  --red-soft: #FBEBEB;
  --amber: #8A5A00;
  --amber-soft: #F9EEDA;
  --shadow-sm: 0 1px 2px rgba(26,29,36,.04), 0 1px 3px rgba(26,29,36,.06);
  --shadow-lg: 0 12px 32px rgba(26,29,36,.14), 0 4px 8px rgba(26,29,36,.05);
  --radius: 10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--ink);
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; cursor: pointer; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
.muted { color: var(--grey-500); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, 'JetBrains Mono', Menlo, monospace; font-size: 12.5px; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 16px; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--ink); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art .brand { display: flex; gap: 12px; align-items: center; }
.login-art h2 { font-size: 34px; line-height: 1.15; font-weight: 700; max-width: 440px; letter-spacing: -.02em; }
.login-art p { color: #B8BDC8; max-width: 420px; margin-top: 14px; }
.login-art .foot { color: #8A90A0; font-size: 12px; }
.login-art svg.rings { position: absolute; right: -120px; bottom: -120px; opacity: .18; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-card { width: 100%; max-width: 360px; }
.login-card h1 { margin-bottom: 4px; }
.login-card .inst { color: var(--grey-500); margin-bottom: 28px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.shell > div { min-width: 0; }
.side { background: var(--white); border-right: 1px solid var(--border); padding: 18px 12px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand .mark { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; flex-shrink: 0; }
.brand .name { font-weight: 700; font-size: 15px; line-height: 1.1; }
.brand .sub { font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--grey-500); }
.nav a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; color: var(--grey-700); font-weight: 500; font-size: 13.5px; }
.nav a:hover { background: var(--grey-50); color: var(--ink); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-dark); }
.nav .icon { width: 17px; height: 17px; }
.nav .count { margin-left: auto; background: var(--orange); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 7px; font-weight: 600; }
.side .who { margin-top: auto; border-top: 1px solid var(--border); padding: 12px 8px 0; font-size: 12.5px; }
.side .who .role { color: var(--grey-500); text-transform: capitalize; }
.main { padding: 28px 36px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .sub { color: var(--grey-500); margin-top: 2px; }
.topbar-mobile { display: none; }

.icon { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.75; fill: none; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ---------- cards, stats ---------- */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { padding: 16px 18px; }
.stat .label { font-size: 12px; color: var(--grey-500); font-weight: 500; }
.stat .value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .note { font-size: 12px; color: var(--grey-500); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--grey-500); font-weight: 600;
  padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--grey-50); white-space: nowrap; }
table.t td { padding: 10px 14px; border-bottom: 1px solid var(--grey-100); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--grey-50); }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.t tr.struck td { color: var(--grey-500); text-decoration: line-through; }
table.t tfoot td { font-weight: 650; background: var(--grey-50); }
.empty { padding: 28px; text-align: center; color: var(--grey-500); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--grey-100); color: var(--grey-700); text-transform: capitalize; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.blue { background: var(--accent-soft); color: var(--accent-dark); }
.grade { display: inline-block; min-width: 26px; text-align: center; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--grey-100); }
.grade.A { background: var(--green-soft); color: var(--green); }
.grade.F { background: var(--red-soft); color: var(--red); }

/* ---------- forms ---------- */
label.f { display: block; }
label.f > span { display: block; font-size: 12px; font-weight: 600; color: var(--grey-700); margin-bottom: 5px; }
input, select, textarea { font: inherit; color: inherit; border: 1px solid var(--grey-300); border-radius: 8px; padding: 8px 11px; background: #fff; width: 100%; min-height: 38px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type=checkbox] { width: auto; min-height: 0; }
textarea { min-height: 70px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.inline-input { width: 72px; min-height: 32px; padding: 4px 8px; text-align: right; font-variant-numeric: tabular-nums; }
.search { max-width: 320px; }

button, .btn { font: inherit; font-weight: 600; font-size: 13.5px; border: 1px solid transparent; border-radius: 8px; padding: 8px 15px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px; background: var(--ink); color: #fff; min-height: 38px; white-space: nowrap; }
button:hover { background: var(--ink-soft); }
button.primary { background: var(--accent); }
button.primary:hover { background: var(--accent-dark); }
button.ghost { background: #fff; color: var(--ink); border-color: var(--grey-300); }
button.ghost:hover { background: var(--grey-50); }
button.danger { background: #fff; color: var(--red); border-color: #F0C7C3; }
button.danger:hover { background: var(--red-soft); }
button.sm { padding: 4px 10px; min-height: 30px; font-size: 12.5px; }
button:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--grey-700); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.active { color: var(--accent-dark); border-bottom-color: var(--accent); font-weight: 600; }

/* ---------- notices ---------- */
.notice { border-radius: 8px; padding: 10px 14px; font-size: 13px; border: 1px solid; }
.notice.red { background: var(--red-soft); border-color: #F0C7C3; color: #7A1A12; }
.notice.amber { background: var(--amber-soft); border-color: #EED9A8; color: #5E3D00; }
.notice.green { background: var(--green-soft); border-color: #BFE3BE; color: #14542A; }
.notice.blue { background: var(--accent-soft); border-color: #C9DDEC; color: var(--accent-dark); }
.notice ul { margin: 6px 0 0 18px; }
.check-list li { list-style: none; display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--grey-100); }
.check-list li:last-child { border-bottom: 0; }
.tick { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-size: 12px; font-weight: 700; }
.tick.yes { background: var(--green-soft); color: var(--green); }
.tick.no { background: var(--red-soft); color: var(--red); }

/* ---------- modal, toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(26,29,36,.45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.modal.wide { max-width: 860px; }
.modal-head { padding: 18px 22px 0; display: flex; align-items: center; }
.modal-body { padding: 16px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px 18px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--grey-100); }
.x { background: none; color: var(--grey-500); padding: 4px; min-height: 0; margin-left: auto; }
.x:hover { background: var(--grey-100); }
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 9px; box-shadow: var(--shadow-lg); max-width: 380px; font-size: 13.5px; }
.toast.error { background: var(--red); }
.credential { background: var(--grey-50); border: 1px dashed var(--grey-300); border-radius: 8px; padding: 12px 14px; margin-top: 10px; }
.credential b { font-family: ui-monospace, Menlo, monospace; font-size: 15px; }

/* ---------- gradebook ---------- */
.gradebook td, .gradebook th { padding: 7px 10px; }
.gradebook th small { display: block; font-weight: 500; text-transform: none; letter-spacing: 0; }
.status-line { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }

/* ---------- record ---------- */
.term-block + .term-block { margin-top: 16px; }
.term-foot { display: flex; gap: 20px; padding: 10px 14px; background: var(--grey-50); font-size: 12.5px; color: var(--grey-700); border-top: 1px solid var(--border); flex-wrap: wrap; border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; z-index: 40; width: 260px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .side.open { transform: none; }
  .topbar-mobile { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
  .main { padding: 18px 16px 50px; }
  .grid-2, .form-grid { grid-template-columns: 1fr; }
  .stat .value { font-size: 22px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px 14px; }
}

/* Phones: table rows become stacked cards (the gradebook keeps its grid and scrolls). */
@media (max-width: 600px) {
  table.t:not(.gradebook) thead { display: none; }
  table.t:not(.gradebook), table.t:not(.gradebook) tbody, table.t:not(.gradebook) tfoot { display: block; }
  table.t:not(.gradebook) tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--grey-100); }
  table.t:not(.gradebook) td { display: flex; justify-content: space-between; align-items: center; gap: 14px; border: 0; padding: 3px 16px; text-align: right; }
  table.t:not(.gradebook) td::before { content: attr(data-label); color: var(--grey-500); font-size: 12px; text-align: left; flex-shrink: 0; }
  table.t:not(.gradebook) td[data-label=""]::before { content: none; }
  table.t:not(.gradebook) td:first-child { font-size: 15px; }
  .page-head h1 { font-size: 20px; }
}
