@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@500;600;700&family=Work+Sans:wght@400;500;600&display=swap');

:root {
  --asphalt: #1C1E22;
  --asphalt-2: #2A2D32;
  --paper: #F6F4EF;
  --paper-2: #FFFFFF;
  --line-yellow: #E8B93A;
  --line-yellow-dark: #B8890F;
  --ink: #262A2E;
  --ink-soft: #6B7280;
  --hairline: #DEDACF;
  --go: #2F7A4F;
  --go-bg: #E5F1E9;
  --stop: #B5392F;
  --stop-bg: #FBEAE8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Work Sans', sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
}

h1, h2, h3, .headline {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  letter-spacing: 0.2px;
  margin: 0;
}

.topbar {
  background: var(--asphalt);
  color: var(--paper);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--line-yellow);
  position: relative;
  flex-shrink: 0;
}

.brand-mark::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 3px;
  background: var(--asphalt);
  transform: translate(-50%, -50%);
  box-shadow: 0 -7px 0 0 var(--asphalt), 0 7px 0 0 var(--asphalt);
}

.brand-name {
  font-family: 'Oswald', sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--paper);
}

.topbar .who {
  font-size: 14px;
  color: #C9CBCF;
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar button.link {
  background: none;
  border: none;
  color: var(--line-yellow);
  font-family: 'Work Sans', sans-serif;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.lane-divider {
  height: 3px;
  margin: 32px 0;
  background-image: repeating-linear-gradient(to right, var(--line-yellow) 0, var(--line-yellow) 22px, transparent 22px, transparent 40px);
}

.hero { text-align: left; margin-bottom: 8px; }

.hero h1 { font-size: 34px; color: var(--asphalt); margin-bottom: 8px; }

.hero p { color: var(--ink-soft); font-size: 16px; max-width: 480px; }

.role-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 32px;
}

@media (max-width: 620px) {
  .role-grid { grid-template-columns: 1fr; }
}

.role-card {
  background: var(--paper-2);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 28px 24px;
  cursor: pointer;
  text-align: left;
  font-family: 'Work Sans', sans-serif;
}

.role-card:hover { border-color: var(--asphalt); }

.role-card h3 { font-size: 19px; color: var(--asphalt); margin-bottom: 6px; }

.role-card p { color: var(--ink-soft); font-size: 14px; margin: 0; }

.card {
  background: var(--paper-2);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 28px;
  max-width: 420px;
}

.card.wide { max-width: none; }

label {
  display: block;
  font-size: 13px;
  color: var(--ink-soft);
  margin: 16px 0 6px;
}

label:first-of-type { margin-top: 0; }

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  font-family: 'Work Sans', sans-serif;
  border: 1px solid var(--hairline);
  border-radius: 3px;
  background: var(--paper);
  color: var(--ink);
}

textarea { resize: vertical; min-height: 60px; line-height: 1.4; }

input:focus, select:focus, textarea:focus { outline: none; border-color: var(--asphalt); }

input:disabled { background: var(--paper-2); color: var(--ink-soft); }

.btn {
  display: inline-block;
  padding: 11px 22px;
  font-family: 'Work Sans', sans-serif;
  font-weight: 500;
  font-size: 15px;
  border-radius: 3px;
  border: 1px solid var(--asphalt);
  background: var(--asphalt);
  color: var(--paper);
  cursor: pointer;
}

.btn:hover { background: var(--asphalt-2); }

.btn.accent {
  background: var(--line-yellow);
  border-color: var(--line-yellow-dark);
  color: var(--asphalt);
}

.btn.accent:hover { background: #DCAB2C; }

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--hairline);
}

.btn.ghost:hover { border-color: var(--asphalt); }

.btn.small { padding: 7px 14px; font-size: 13px; }

.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.form-actions { margin-top: 22px; display: flex; gap: 10px; align-items: center; }

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 28px;
}

.tab {
  padding: 10px 18px;
  font-family: 'Oswald', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  background: none;
  border-top: none; border-left: none; border-right: none;
}

.tab.active { color: var(--asphalt); border-bottom-color: var(--line-yellow); }

.auth-toggle { display: flex; gap: 18px; margin-bottom: 20px; }

.auth-toggle button {
  background: none;
  border: none;
  font-family: 'Oswald', sans-serif;
  font-size: 15px;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0 0 6px;
  border-bottom: 3px solid transparent;
}

.auth-toggle button.active { color: var(--asphalt); border-bottom-color: var(--line-yellow); }

.error-msg {
  background: var(--stop-bg);
  color: var(--stop);
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 3px;
  margin-top: 14px;
}

.success-msg {
  background: var(--go-bg);
  color: var(--go);
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 3px;
  margin-bottom: 20px;
}

.date-group { margin-bottom: 28px; }

.date-heading {
  font-family: 'Oswald', sans-serif;
  font-size: 15px;
  color: var(--asphalt);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--hairline);
}

.slot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--paper-2);
  border: 1px solid var(--hairline);
  border-radius: 3px;
  margin-bottom: 8px;
  gap: 12px;
  flex-wrap: wrap;
}

.slot-time {
  font-family: 'Oswald', sans-serif;
  font-size: 17px;
  color: var(--asphalt);
  min-width: 70px;
}

.slot-meta { font-size: 13px; color: var(--ink-soft); flex: 1; }

.slot-price { font-family: 'Oswald', sans-serif; font-size: 15px; color: var(--asphalt); }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 9px;
  border-radius: 3px;
  letter-spacing: 0.3px;
}

.badge.available { background: var(--go-bg); color: var(--go); }
.badge.booked { background: var(--stop-bg); color: var(--stop); }
.badge.paid { background: var(--go-bg); color: var(--go); }
.badge.unpaid { background: #FBF2E0; color: #8C5E0B; }

.slot-actions { display: flex; gap: 8px; }

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-soft);
  background: var(--paper-2);
  border: 1px dashed var(--hairline);
  border-radius: 4px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 30, 34, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 50;
  padding: 20px;
  overflow-y: auto;
}

.modal {
  background: var(--paper-2);
  border-radius: 4px;
  padding: 30px;
  max-width: 380px;
  width: 100%;
  margin: auto;                 /* vertically centre when it fits */
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal h3 { font-size: 20px; color: var(--asphalt); margin-bottom: 4px; }
.modal .lesson-summary { font-size: 14px; color: var(--ink-soft); margin-bottom: 20px; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.note { font-size: 12px; color: var(--ink-soft); margin-top: 10px; }

.footer-note {
  margin-top: 60px;
  padding-top: 20px;
  border-top: 1px solid var(--hairline);
  font-size: 12px;
  color: var(--ink-soft);
}

.setup-notice {
  background: #FBF2E0;
  border: 1px solid var(--line-yellow-dark);
  border-radius: 4px;
  padding: 20px 24px;
  color: #6b4e0b;
  font-size: 14px;
}

.setup-notice h3 { color: #6b4e0b; margin-bottom: 8px; font-size: 17px; }
.setup-notice code {
  background: rgba(0,0,0,0.06);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 13px;
}

.hours-grid { display: flex; flex-direction: column; gap: 10px; }

.hours-row {
  display: grid;
  grid-template-columns: 150px 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

.hours-row input[type="time"] { width: 100%; }

.hours-day {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 14px;
  color: var(--ink);
}

.hours-day input { width: auto; }

@media (max-width: 560px) {
  .hours-row { grid-template-columns: 1fr 1fr; }
  .hours-row .hours-day { grid-column: 1 / -1; }
  .hours-row span { display: none; }
}

.balance-banner {
  background: var(--go-bg);
  border: 1px solid #BBD9C6;
  border-radius: 4px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--ink);
}

.student-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.student-balance {
  font-family: 'Oswald', sans-serif;
  font-size: 15px;
  color: var(--asphalt);
  background: var(--go-bg);
  padding: 4px 10px;
  border-radius: 3px;
  white-space: nowrap;
}

.grant-form { margin-top: 4px; }

.student-contact { margin-top: 6px; }
.student-edit-form { margin-top: 6px; }

.addr-link {
  display: inline-block;
  color: var(--go);
  font-size: 13px;
  text-decoration: none;
  line-height: 1.35;
}
.addr-link:hover { text-decoration: underline; }

.cal-ev-pin {
  display: inline-block;
  margin: 2px 0;
  cursor: pointer;
  font-family: 'Work Sans', sans-serif;
  font-size: 9px;
  font-weight: 600;
  line-height: 1.4;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--line-yellow);
  color: var(--asphalt);
  white-space: nowrap;
}
.cal-ev-pin:hover { background: #DCAB2C; }

.credit-history {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--hairline);
}

.credit-line {
  font-size: 12px;
  color: var(--ink-soft);
  padding: 2px 0;
}

/* ---- Week calendar ---- */
.cal-bar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; margin-bottom: 10px;
}
.cal-nav { display: flex; gap: 6px; }
.cal-nav .btn.small { padding: 6px 12px; }
.cal-range { font-family: 'Oswald', sans-serif; font-size: 15px; color: var(--asphalt); }

.cal-legend {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 12px; color: var(--ink-soft); margin-bottom: 10px;
}
.cal-legend .sw {
  display: inline-block; width: 12px; height: 12px; border-radius: 2px;
  margin-right: 5px; vertical-align: -1px;
}
.sw.online { background: var(--go-bg); border-left: 3px solid var(--go); }
.sw.credit { background: #E7EEF6; border-left: 3px solid #3D6AA8; }
.sw.manual { background: #FBF2E0; border-left: 3px solid var(--line-yellow-dark); }
.sw.off { background: repeating-linear-gradient(45deg, #E6E2D8, #E6E2D8 4px, #EFECE4 4px, #EFECE4 8px); }

.cal-scroll {
  overflow: auto;
  max-height: 65vh;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  -webkit-overflow-scrolling: touch;
}
/* mirror scrollbar shown above the calendar when its own is off-screen */
.cal-scroll-top {
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--hairline);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
}
.cal-scroll-top > div { height: 1px; }
.cal-grid {
  display: grid;
  grid-template-columns: 56px repeat(7, minmax(116px, 1fr));
  min-width: 840px;
  background: var(--paper-2);
}
/* top-left corner: frozen on both axes */
.cal-corner {
  grid-column: 1; grid-row: 1;
  position: sticky; top: 0; left: 0; z-index: 6;
  background: var(--paper-2);
  border-bottom: 1px solid var(--hairline);
  border-right: 1px solid var(--hairline);
}
/* day headers: frozen while scrolling vertically */
.cal-dayhead {
  grid-row: 1; text-align: center;
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--paper-2);
  font-family: 'Oswald', sans-serif; font-size: 12px; color: var(--ink-soft);
  padding: 4px; line-height: 1.25;
  border-bottom: 1px solid var(--hairline);
  border-left: 1px solid var(--hairline);
}
.cal-dayhead b { display: block; font-size: 17px; color: var(--asphalt); }
.cal-dayhead.is-today b { color: var(--line-yellow-dark); }

/* time labels: frozen while scrolling sideways */
.cal-hour {
  grid-column: 1;
  position: sticky; left: 0; z-index: 5;
  background: var(--paper-2);
  font-size: 11px; color: var(--ink-soft); text-align: right;
  padding: 1px 6px 0 0;
  border-top: 1px solid var(--hairline);
  border-right: 1px solid var(--hairline);
}
.cal-cell {
  border-left: 1px solid var(--hairline);
}
.cal-cell.hour { border-top: 1px solid var(--hairline); }
.cal-cell.open { background: var(--paper-2); cursor: pointer; }
.cal-cell.open:hover { background: #FBF3DE; }
.cal-cell.closed { background: #F1EEE7; }

.cal-event {
  margin: 1px 2px; border: none; border-left: 3px solid var(--go);
  background: var(--go-bg); border-radius: 3px; padding: 2px 5px;
  font-family: 'Work Sans', sans-serif; font-size: 11px; line-height: 1.15;
  text-align: left; cursor: pointer; overflow: hidden; z-index: 3;
}
.cal-event.online { background: var(--go-bg); border-left-color: var(--go); }
.cal-event.manual { background: #FBF2E0; border-left-color: var(--line-yellow-dark); }
.cal-event.credit { background: #E7EEF6; border-left-color: #3D6AA8; }
.cal-event:hover { filter: brightness(0.97); }
.cal-ev-time { font-family: 'Oswald', sans-serif; font-weight: 600; color: var(--asphalt); display: block; }
.cal-ev-name { color: var(--ink); display: block; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }

.cal-off {
  margin: 1px 2px; z-index: 2; border: none; border-radius: 2px; cursor: pointer;
  background: repeating-linear-gradient(45deg, #E6E2D8, #E6E2D8 5px, #EFECE4 5px, #EFECE4 10px);
  font-family: 'Work Sans', sans-serif; font-size: 10px; color: #6B6555;
  text-align: center; padding: 2px 4px; line-height: 1.2;
}
.cal-off:hover { filter: brightness(0.96); }
.cal-off-day { display: flex; align-items: flex-start; justify-content: center; padding-top: 6px; }

/* ---- Student month picker ---- */
.month-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.month-label { font-family: 'Oswald', sans-serif; font-size: 17px; color: var(--asphalt); }

.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.month-dow {
  text-align: center; font-size: 11px; letter-spacing: 0.5px;
  font-family: 'Oswald', sans-serif; color: var(--ink-soft); padding-bottom: 2px;
}
.month-cell {
  position: relative; aspect-ratio: 1 / 1;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--hairline); border-radius: 4px;
  background: var(--paper-2); color: var(--ink-soft); font-size: 14px;
}
.month-cell.blank { border: none; background: transparent; }
.month-cell.muted { opacity: 0.45; }
.month-cell.has-avail {
  color: var(--asphalt); font-weight: 600;
  background: var(--go-bg); border-color: #BBD9C6; cursor: pointer;
}
.month-cell.has-avail:hover { background: #D6EADF; }
.month-cell.is-today { border-color: var(--asphalt); }
.month-cell.picked { outline: 2px solid var(--asphalt); outline-offset: -1px; }
.mc-dot {
  position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%);
  width: 5px; height: 5px; border-radius: 50%; background: var(--go);
}

.qty-row {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; margin: 10px 0 6px;
}
.qty-row .btn { min-width: 44px; font-size: 18px; padding: 6px 0; }
.qty-val {
  font-family: 'Oswald', sans-serif; font-size: 18px; color: var(--asphalt);
  text-align: center; min-width: 118px;
}
.qty-val .note { display: block; margin-top: 2px; }

.day-modal { max-width: 420px; }
.day-slots {
  max-height: 55vh; overflow-y: auto;
  margin-top: 4px; border-top: 1px solid var(--hairline);
}
.day-slots .slot-row { padding: 10px 12px; margin-bottom: 6px; }
