/* ============================================================
   AMERICA READS TUTORS — visual design
   Direction: an official ISU program ledger. Teachers and tutors fill
   in rows on a shared weekly roster; the coordinator reads the same
   ledger from an admin view. Hairline rules and ruled rows carry
   structure instead of cards/shadows/border-radius.
   Palette: ISU Bengal Black, Roarange, Growling Gray — per
   isu.edu/brand/design/colors (official ISU brand colors).
   Type: Roboto Slab (headings) + Roboto (UI/body) — ISU's own
   approved free-Google-Fonts fallback for Museo Slab / Museo Sans,
   per isu.edu/brand/design/fonts.
   ============================================================ */

:root {
  --ink: #222222;        /* ISU Bengal Black */
  --ink-soft: #424242;   /* ISU Dark */
  --paper: #ededed;      /* ISU Gray */
  --paper-raised: #ffffff;
  --rule: #d9d9d9;
  --gold: #f47920;       /* ISU Roarange (accents/backgrounds only — not text on white) */
  --gold-deep: #b82b00;  /* ISU Links color — accessible on white */
  --button: #d4441c;     /* ISU Buttons color (use with white text) */
  --green: #2e7d32;
  --green-soft: #e7efe6;
  --red: #9c3b3b;
  --red-soft: #f5e8e6;
  --slate: #656565;

  --serif: "Roboto Slab", Georgia, serif;
  --sans: "Roboto", -apple-system, BlinkMacSystemFont, sans-serif;

  --radius: 3px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
}

.jump-nav-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin: 16px 0 20px;
  font-size: 13px;
}
.jump-nav {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 13px;
}
.jump-nav a {
  color: var(--gold-deep);
  text-decoration: none;
}
.jump-nav a:hover { text-decoration: underline; }

/* ---------- Masthead ---------- */

.masthead {
  background: #ffffff;
  color: var(--ink);
  border-bottom: 4px solid var(--gold);
}

.masthead-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.mark {
  display: flex;
  align-items: center;
  gap: 16px;
}
.mark img { display: block; height: 36px; width: auto; }
.mark-divider { width: 1px; height: 28px; background: var(--rule); }
.mark-line2 { font-family: var(--serif); font-size: 18px; font-weight: 700; color: var(--ink); }

.masthead-meta {
  font-size: 13px;
  color: var(--slate);
  font-family: var(--sans);
}
.masthead-meta .dot { margin: 0 6px; color: var(--gold); }

/* ---------- Layout ---------- */

.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 60px;
  min-height: 60vh;
}

.ledger-page {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  padding: 28px 30px;
}

.ledger-heading {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px;
}

.ledger-sub {
  color: var(--slate);
  margin: 0 0 22px;
  font-size: 14px;
}

/* Portal chooser: spine tabs, not cards */
.portal-picker {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 28px;
}
.portal-tab {
  font-family: var(--serif);
  font-size: 15px;
  padding: 10px 18px;
  border: none;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}
.portal-tab.active {
  color: var(--ink);
  border-bottom-color: var(--gold);
  font-weight: 600;
}
.portal-tab:hover { color: var(--ink); }

.role-intro {
  padding: 40px 0 60px;
  text-align: left;
}
.role-intro h1 {
  font-family: var(--serif);
  font-size: 30px;
  max-width: 22ch;
  margin: 0 0 10px;
}
.role-intro p {
  max-width: 56ch;
  color: var(--ink-soft);
}
.role-links {
  margin-top: 26px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.role-links a.button { text-decoration: none; }

/* ---------- Forms ---------- */

.field-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
  align-items: start;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
}
.field-row:last-of-type { border-bottom: none; }
.field-row label {
  font-weight: 500;
  padding-top: 8px;
}
.field-hint {
  font-size: 12px;
  color: var(--slate);
  margin-top: 4px;
}

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
select, textarea {
  width: 100%;
  font-family: var(--sans);
  font-size: 14px;
  padding: 9px 10px;
  border: 1px solid var(--rule);
  background: #fff;
  color: var(--ink);
  border-radius: var(--radius);
}
textarea { resize: vertical; min-height: 70px; }

.checkbox-grid, .day-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.chip-toggle {
  border: 1px solid var(--rule);
  background: #fff;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-family: var(--sans);
}
.chip-toggle.selected {
  background: var(--ink);
  color: #ffffff;
  border-color: var(--ink);
}

.time-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.time-row button.remove {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-size: 13px;
}

button, .button {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--button);
  background: var(--button);
  color: #ffffff;
  cursor: pointer;
}
button:hover { background: #b8390f; }
.button.secondary, button.secondary {
  background: transparent;
  border-color: var(--ink);
  color: var(--ink);
}
.button.secondary:hover, button.secondary:hover { background: var(--paper); }
button.link-btn {
  background: none;
  border: none;
  color: var(--gold-deep);
  padding: 0;
  text-decoration: underline;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }

.form-actions {
  margin-top: 22px;
  display: flex;
  gap: 12px;
}

/* ---------- Ledger table ---------- */

table.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.ledger-table th {
  text-align: left;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 13px;
  padding: 8px 10px;
  border-bottom: 2px solid var(--ink);
  color: var(--ink);
}
table.ledger-table th.sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
table.ledger-table th.sortable-th:hover {
  color: var(--gold-deep);
}
.sort-indicator {
  color: var(--gold);
  font-size: 11px;
}
table.ledger-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}
table.ledger-table tr:hover td { background: rgba(244, 121, 32, 0.06); }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.badge.open { background: var(--green-soft); color: var(--green); }
.badge.full { background: var(--red-soft); color: var(--red); }
.badge.pending { background: #fde3d1; color: var(--gold-deep); }

/* ---------- Stats strip ---------- */

.stats-strip {
  display: flex;
  gap: 0;
  margin-bottom: 26px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.stat {
  flex: 1;
  padding: 14px 18px;
  border-right: 1px solid var(--rule);
}
.stat:last-child { border-right: none; }
.stat-value {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  display: block;
}
.stat-label {
  font-size: 12px;
  color: var(--slate);
}

/* ---------- Filters ---------- */

.filter-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.filter-row select { width: auto; min-width: 140px; }

/* ---------- Scrollable tables (mobile) ---------- */

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ---------- Teacher schedule week grid ---------- */

.week-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 26px;
}
.week-grid-day {
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--slate);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 8px;
}
.week-grid-card {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 8px;
  text-align: center;
  margin-bottom: 8px;
}
.week-grid-card-name { font-size: 13px; font-weight: 500; }

/* ---------- Contact block ---------- */

.contact-block, .site-footer {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px;
  font-size: 13px;
  color: var(--slate);
  border-top: 1px solid var(--rule);
}
.contact-block strong { color: var(--ink); }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--ink);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }

/* ---------- Admin panel ---------- */

.admin-section {
  margin-bottom: 34px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--rule);
}
.admin-section:last-child { border-bottom: none; }
.admin-section h3 {
  font-family: var(--serif);
  font-size: 17px;
  margin: 0 0 14px;
}
.admin-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 13.5px;
}

@media (max-width: 640px) {
  .field-row { grid-template-columns: 1fr; }
  .stats-strip { flex-wrap: wrap; }
  .stat { flex: 1 1 50%; border-bottom: 1px solid var(--rule); }

  .app { padding: 20px 14px 48px; }
  .ledger-page { padding: 20px 16px; }

  /* Data tables scroll horizontally instead of squeezing unreadably narrow */
  table.ledger-table { font-size: 12.5px; }
  .table-scroll table.ledger-table { min-width: 560px; }

  /* Teacher's weekly grid stacks to one day per row on a phone screen — each day's own
     label stays directly above its cards, so nothing about the layout needs to change in JS. */
  .week-grid { grid-template-columns: 1fr; }
  .week-grid-day { margin-top: 14px; }
  .week-grid-day:first-child { margin-top: 0; }

  .time-row input[type="text"] { flex: 1 1 70px; min-width: 0; }
  .time-row select { flex: 1 1 110px; }

  .role-links { flex-direction: column; align-items: stretch; }
  .role-links a.button { text-align: center; }
}
