:root {
  --bg: #F4F6F7;
  --surface: #FFFFFF;
  --ink: #16212B;
  --muted: #5B6B77;
  --line: #DEE3E6;
  --line-soft: #EAEDEF;
  --accent: #2B5F62;
  --accent-dark: #204648;
  --accent-soft: #E3EDEC;
  --danger: #B3261E;
  --danger-soft: #FBEAE9;
  --success: #1E6B44;
  --success-soft: #E7F3EC;
}
* { box-sizing: border-box; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  margin: 0;
  font-size: 15px;
}
h1, h2, h3 { font-family: "Source Serif 4", Georgia, serif; font-weight: 600; margin: 0 0 6px; color: var(--ink); }
h1 { font-size: 1.5rem; }
h3 { font-size: 1.02rem; }
.muted { color: var(--muted); font-size: 0.88rem; }
a { color: var(--accent); }

/* ---------- shell ---------- */
.shell { display: flex; flex-direction: column; min-height: 100vh; }
.topnav {
  background: #FFFFFF; border-bottom: 1px solid var(--line);
}
.topnav-row {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 10px 24px; max-width: 1400px; margin: 0 auto;
}
.topnav .brand {
  font-family: "Source Serif 4", serif; font-weight: 700; font-size: 1.05rem; color: var(--ink);
  text-decoration: none; flex-shrink: 0;
  display: flex; flex-direction: row; align-items: center; gap: 8px;
}
.topnav .brand img { width: 34px; height: auto; display: block; }
.topnav nav { display: flex; flex-direction: row; flex-wrap: wrap; flex: 1; }
.topnav nav a {
  color: var(--muted); text-decoration: none; padding: 7px 10px; margin-right: 2px; border-radius: 6px;
  font-size: 0.88rem; font-weight: 500; white-space: nowrap;
}
.topnav nav a:hover { background: var(--bg); color: var(--ink); }
.topnav nav a.active { background: var(--accent-soft); color: var(--accent-dark); }
.topnav .who {
  display: flex; align-items: center; flex-shrink: 0; margin-left: auto;
  padding-left: 16px; border-left: 1px solid var(--line-soft);
}
.topnav .who .name { font-weight: 600; font-size: 0.85rem; margin-right: 8px; }
.topnav .who .role { color: var(--muted); font-size: 0.76rem; text-transform: capitalize; margin-right: 14px; }
.topnav .who a { color: var(--muted); font-size: 0.8rem; text-decoration: none; white-space: nowrap; margin-right: 14px; }
.topnav .who a:last-child { margin-right: 0; }
.topnav .who a:hover { color: var(--accent); }

.main { flex: 1; min-width: 0; }
.container { max-width: 1080px; margin: 0 auto; padding: 32px 28px 60px; }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 20px; margin-bottom: 18px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- dashboard header ---------- */
.dash-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; flex-wrap: wrap; gap: 10px; }
.dash-summary { color: var(--muted); font-size: 0.92rem; margin-bottom: 20px; }
.dash-summary strong { color: var(--ink); font-weight: 600; }
.dash-summary .sep { margin: 0 8px; color: var(--line); }

.search-bar { display: flex; gap: 8px; margin-bottom: 22px; }
.search-bar input {
  flex: 1; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 0.95rem; background: var(--surface);
}
.search-bar input:focus { outline: none; border-color: var(--accent); }
.search-bar button { padding: 10px 18px; }

/* ---------- table ---------- */
table.data-table { width: 100%; border-collapse: collapse; }
table.data-table.small { font-size: 0.87rem; }
table.data-table th, table.data-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
table.data-table th {
  color: var(--muted); font-weight: 500; font-size: 0.78rem; letter-spacing: 0.02em;
}
table.data-table tbody tr:hover { background: var(--bg); }
table.dropped-course-table tbody tr { opacity: 0.55; }
table.kv td:first-child { color: var(--muted); width: 140px; padding: 6px 10px; font-size: 0.88rem; }
table.kv td { padding: 6px 10px; }

.student-row { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark);
  display: flex; align-items: center; justify-content: center; font-size: 0.76rem; font-weight: 600; flex-shrink: 0;
}
.pill {
  display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 0.76rem; font-weight: 500;
  background: var(--accent-soft); color: var(--accent-dark);
}

/* ---------- buttons ---------- */
button, .btn, .btn-secondary {
  background: var(--accent); color: #fff; border: none; padding: 9px 16px;
  border-radius: 7px; cursor: pointer; font-size: 0.9rem; font-weight: 500; text-decoration: none; display: inline-block;
}
button:hover, .btn:hover { background: var(--accent-dark); }
.btn-secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn-secondary:hover { background: var(--bg); }

.inline-form { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.inline-form input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 0.9rem; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid label { display: flex; flex-direction: column; font-size: 0.85rem; color: var(--muted); gap: 4px; }
.form-grid input, .form-grid select {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 0.95rem; color: var(--ink);
}
.form-actions { grid-column: 1 / -1; display: flex; gap: 10px; margin-top: 8px; }

.search-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.search-grid label { display: flex; flex-direction: column; font-size: 0.85rem; color: var(--muted); gap: 4px; }
.search-grid input {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 0.95rem; color: var(--ink);
}

.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.report-icon {
  width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; margin-bottom: 10px;
}
.report-icon svg { width: 19px; height: 19px; }
.report-icon.ic-teal { background: var(--accent-soft); color: var(--accent-dark); }
.report-icon.ic-amber { background: #FBF0DC; color: #8A5A00; }
.report-icon.ic-green { background: var(--success-soft); color: var(--success); }
.report-icon.ic-red { background: #FBE7E5; color: #B3261E; }
.report-icon.ic-purple { background: #EDE7F6; color: #5E35B1; }
.report-icon.ic-blue { background: #E3EEFC; color: #1565C0; }
.report-card {
  display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 18px; text-decoration: none; color: inherit; transition: border-color 0.15s;
}
.report-card:hover { border-color: var(--accent); }
.report-card h3 { margin: 0 0 8px; font-size: 1.05rem; color: var(--ink); }
.report-card p { margin: 0; font-size: 0.85rem; }
.report-summary-line { font-size: 1.1rem; font-weight: 700; color: var(--ink); margin-bottom: 6px; }

.lms-password-line { font-size: 0.95rem; color: var(--ink); margin-bottom: 14px; }
.lms-password-line strong { color: #1E6B44; font-size: 1.1rem; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(22,33,43,0.45);
  align-items: center; justify-content: center; z-index: 1000;
}
.modal-box {
  background: var(--surface); border-radius: 10px; padding: 22px;
  width: 90%; max-width: 420px; box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}

.server-stat-label { font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.server-stat-bar { background: var(--line-soft); border-radius: 6px; height: 10px; overflow: hidden; margin-bottom: 4px; }
.server-stat-fill { height: 100%; border-radius: 6px; transition: width 0.3s; }
.server-stat-value { font-size: 0.85rem; color: var(--ink); }

.hope-checkbox {
  display: flex !important; flex-direction: row !important; align-items: center; gap: 8px;
  background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 8px;
  padding: 12px 14px; font-weight: 600; font-size: 0.95rem; color: var(--accent-dark);
  cursor: pointer;
}
.hope-checkbox input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }

.grade-average-badge {
  display: inline-flex; flex-direction: column; align-items: flex-start;
  background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 8px;
  padding: 10px 16px;
}
.grade-average-badge .amt { font-family: "Source Serif 4", serif; font-size: 1.6rem; font-weight: 700; color: var(--accent-dark); }
.grade-average-badge .label { font-size: 0.8rem; color: var(--muted); }

.course-select-lg {
  font-size: 1rem; padding: 9px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); font-weight: 500; min-width: 220px;
}

/* ---------- notes ---------- */
.note-block { border-bottom: 1px solid var(--line-soft); padding: 14px 0; }
.note-block:first-of-type { padding-top: 0; }
.note-view-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.note-date { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.note-text { margin: 0; white-space: pre-wrap; line-height: 1.5; font-size: 0.95rem; }
.note-edit-btn { padding: 4px 12px; font-size: 0.8rem; }
.note-edit { padding-top: 8px; }
.note-edit label { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; max-width: 200px; }
.note-edit input[type="date"] { padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; }
.note-textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-family: inherit; font-size: 0.95rem; line-height: 1.5; resize: vertical;
}

/* ---------- login ---------- */
.login-wrap { display: flex; justify-content: center; align-items: center; min-height: 100vh; }
.login-card { width: 320px; display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { text-align: center; margin-bottom: 6px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--muted); }
.login-card input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }

/* ---------- flash ---------- */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 0.9rem; }
.flash-error { background: var(--danger-soft); color: var(--danger); }
.flash-success { background: var(--success-soft); color: var(--success); }

/* ---------- student detail ---------- */
.detail-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; gap: 16px; }

.cash-only-banner {
  background: var(--danger-soft); color: var(--danger); font-weight: 700; font-size: 0.9rem;
  padding: 10px 14px; border-radius: 8px; border: 1px solid var(--danger); margin-bottom: 14px;
}
.detail-header h1 { margin-bottom: 2px; }
.balance-badge { text-align: right; }
.balance-badge .amt { font-family: "Source Serif 4", serif; font-size: 1.4rem; font-weight: 600; }
.balance-badge .amt.owed { color: var(--danger); }
.balance-badge .amt.clear { color: var(--success); }
.balance-badge .label { font-size: 0.76rem; color: var(--muted); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 18px 0 20px; }
.tab-btn {
  background: none; border: none; color: var(--muted); padding: 9px 16px; font-size: 0.9rem;
  font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; border-radius: 0;
}
.tab-btn:hover { color: var(--ink); background: none; }
.tab-btn.active { color: var(--accent-dark); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- filter chips ---------- */
.filter-row { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-chip {
  padding: 6px 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); font-size: 0.85rem; text-decoration: none; font-weight: 500;
}
.filter-chip:hover { border-color: var(--accent); color: var(--accent-dark); }
.filter-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- reference data tables ---------- */
.ref-table input[type="text"], .ref-table input:not([type]), .ref-table input[type="number"] {
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 5px; font-size: 0.86rem; width: 100%;
}
.ref-table td { vertical-align: middle; }
.row-actions { display: flex; gap: 6px; white-space: nowrap; }
.row-actions button { padding: 6px 12px; font-size: 0.82rem; }
.btn-danger { background: var(--danger-soft) !important; color: var(--danger) !important; }
.btn-danger:hover { background: var(--danger) !important; color: #fff !important; }
.add-row { display: flex; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft); flex-wrap: wrap; align-items: center; }
.add-row input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 0.9rem; }
.locked-cell { color: var(--muted); }

/* ---------- course catalog picker ---------- */
.add-course-picker {
  display: flex; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft);
  flex-wrap: wrap; align-items: center;
}
.add-course-picker select, .add-course-picker input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 0.9rem; }
.course-search-wrap { position: relative; flex: 1; min-width: 240px; }
.course-search-wrap input { width: 100%; }
.course-suggestions {
  display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 20;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; margin-top: 4px;
  max-height: 220px; overflow-y: auto; box-shadow: 0 4px 14px rgba(0,0,0,0.08);
}
.course-suggestion-item { padding: 8px 12px; font-size: 0.87rem; cursor: pointer; }
.course-suggestion-item:hover { background: var(--accent-soft); }

.term-radio-row { display: flex; align-items: center; gap: 16px; }
.term-radio-row label { display: flex; align-items: center; gap: 5px; font-size: 0.9rem; cursor: pointer; }

/* ---------- overview dashboard ---------- */
.daterange-bar {
  display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap;
}
.daterange-label { font-size: 0.82rem; font-weight: 600; color: var(--accent-dark); }
.daterange-bar label { font-size: 0.85rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.daterange-bar input[type="date"] { padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; }

.donut-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.donut {
  width: 180px; height: 180px; border-radius: 50%; flex-shrink: 0; position: relative;
}
.donut::after {
  content: ""; position: absolute; inset: 32px; background: var(--surface); border-radius: 50%;
}
.donut-legend { list-style: none; margin: 0; padding: 0; font-size: 0.87rem; }
.donut-legend li { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.donut-legend .swatch { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }

/* ---------- stat cards ---------- */
.stat-row { display: flex; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.stat-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 18px 20px; flex: 1; min-width: 190px; display: flex; align-items: center; gap: 14px;
}
.stat-icon {
  width: 42px; height: 42px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.stat-icon.icon-students { background: var(--accent-soft); color: var(--accent-dark); }
.stat-icon.icon-courses { background: #FBF0DC; color: #8A5A00; }
.stat-icon.icon-payments { background: var(--success-soft); color: var(--success); }
.stat-icon svg { width: 21px; height: 21px; }
.stat-num { font-family: "Source Serif 4", serif; font-size: 1.7rem; font-weight: 700; color: var(--ink); line-height: 1.15; }
.stat-label { font-size: 0.82rem; color: var(--muted); }

/* Field-level change history on the Monitoring log. Collapsed by default so the log still
   scans as one line per action; expanded, it shows only what actually changed. */
.change-detail { margin-top: 5px; }
.change-detail summary {
  cursor: pointer; font-size: 0.8rem; color: var(--accent);
  display: inline-block; user-select: none;
}
.change-detail summary:hover { text-decoration: underline; }
.change-detail[open] summary { margin-bottom: 6px; }
table.change-table {
  border-collapse: collapse; font-size: 0.8rem; margin: 0;
  background: var(--paper-2, #FAFBFC); border: 1px solid var(--line-soft); border-radius: 6px;
}
table.change-table th {
  text-align: left; padding: 4px 10px; font-weight: 600; color: var(--muted);
  border-bottom: 1px solid var(--line-soft); font-size: 0.75rem;
}
table.change-table td {
  padding: 4px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top;
}
table.change-table tr:last-child td { border-bottom: none; }
.change-was { color: var(--muted); text-decoration: line-through; }
.change-now { color: var(--ink); font-weight: 600; }
.change-masked { color: var(--muted); font-style: italic; }

/* Small stacked label for the inline "add transcript row" fields. The credits boxes carry a
   default value, so their placeholders never render — two identical 0.5 boxes need a label. */
.add-field-label {
  display: inline-flex; flex-direction: column; gap: 2px;
  font-size: 0.72rem; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.03em; white-space: nowrap;
}
.add-field-label input { font-size: 0.95rem; }

/* Summer school mode: the Term 1 choice is switched off, so it reads as unavailable rather
   than simply unresponsive. */
.term-radio-row label.term-disabled { color: var(--muted); cursor: not-allowed; }
.term-radio-row label.term-disabled input { cursor: not-allowed; }

/* A term with no HOPE Term Code can't be reported accurately — the export falls back to a
   guessed school calendar for it, so the row is marked rather than looking merely blank. */
tr.term-no-hope td { background: #FBF0DC; }
tr.term-no-hope td:first-child { box-shadow: inset 3px 0 0 #C79A3A; }
.add-field-label select { font-size: 0.95rem; }

/* A caution that isn't an error: something exported fine but on guessed values. */
.flash-warn { background: #FBF0DC; color: #7A4F00; }
.flash-warn a { color: #7A4F00; }
