:root {
  --green:       #1f7a3f;
  --green-dark:  #124f2a;
  --green-light: #edf8f0;
  --green-pale:  #f2faf5;
  --leaf:        #8ac146;
  --ink:         #1d2b23;
  --muted:       #607064;
  --soft:        #f6f8f4;
  --line:        #dce7dd;
  --white:       #ffffff;
  --red:         #b84c3d;
  --yellow:      #f3c84b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: Inter, ui-sans-serif, system-ui, sans-serif; background: var(--soft); color: var(--ink); font-size: 15px; line-height: 1.5; }
a { color: var(--green); }

/* Header */
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--green-dark);
  color: white;
  position: sticky;
  top: 0;
  z-index: 20;
}
.cal-brand { font-weight: 850; font-size: 1.05rem; }
.relay-btn {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  color: white;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}
.relay-btn:hover { background: rgba(255,255,255,0.2); }

/* Relay bar */
.relay-bar {
  background: var(--green-pale);
  border-bottom: 1px solid var(--line);
  padding: 16px 28px;
}
.relay-bar.hidden { display: none; }
.relay-bar label { font-weight: 700; font-size: 0.9rem; display: grid; gap: 8px; }
.relay-input-row { display: flex; gap: 8px; }
.relay-input-row input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  font: inherit;
  background: white;
}
.relay-input-row input:focus { outline: none; border-color: var(--green); }
.relay-input-row button {
  padding: 8px 18px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}
.relay-hint { font-size: 0.8rem; color: var(--muted); margin-top: 8px; }
.relay-hint code { background: var(--line); padding: 1px 5px; border-radius: 3px; font-size: 0.78rem; }

/* Main */
.cal-main { max-width: 900px; margin: 0 auto; padding: 28px 20px 60px; }

/* Calendar nav */
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.cal-nav h2 { font-size: 1.3rem; color: var(--ink); }
.cal-nav button {
  width: 38px; height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--green-dark);
  transition: background 120ms;
}
.cal-nav button:hover { background: var(--green-light); }

/* Calendar grid */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 36px;
}
.cal-day-header {
  background: var(--green-dark);
  color: rgba(255,255,255,0.85);
  text-align: center;
  padding: 8px 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.cal-cell {
  background: var(--white);
  min-height: 80px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cal-cell.empty { background: var(--soft); }
.cal-cell.today { background: var(--green-pale); }
.cal-cell.today .cal-date-num { color: var(--green-dark); font-weight: 900; }
.cal-date-num { font-size: 0.82rem; font-weight: 700; color: var(--muted); }
.cal-appt-dot {
  font-size: 0.72rem;
  font-weight: 700;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  transition: opacity 120ms;
}
.cal-appt-dot:hover { opacity: 0.82; }

/* Requests list */
.requests-section h3 {
  font-size: 1.1rem;
  margin-bottom: 14px;
  color: var(--ink);
}
.requests-list { display: grid; gap: 10px; }
.req-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  cursor: pointer;
  transition: box-shadow 140ms, border-color 140ms;
  display: grid;
  gap: 6px;
}
.req-card:hover { border-color: var(--green); box-shadow: 0 4px 16px rgba(31,122,63,0.1); }
.req-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.req-name { font-size: 0.95rem; }
.req-status {
  font-size: 0.72rem;
  font-weight: 800;
  color: white;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.req-meta { font-size: 0.82rem; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }
.req-location { font-size: 0.8rem; color: var(--muted); }
.loading-msg, .no-appts, .error-msg { color: var(--muted); font-size: 0.9rem; padding: 20px 0; }
.error-msg { color: var(--red); }

/* Modal */
.appt-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  padding: 20px;
}
.appt-modal.hidden { display: none; }
.modal-card {
  background: var(--white);
  border-radius: 12px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--green);
  color: white;
  font-size: 1rem;
}
.modal-header button { background: none; border: none; color: white; font-size: 1.1rem; cursor: pointer; }
.modal-body { padding: 18px; }
.modal-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.modal-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.modal-table td:first-child { font-weight: 700; color: var(--muted); white-space: nowrap; width: 90px; }

@media (max-width: 600px) {
  .cal-cell { min-height: 56px; }
  .cal-appt-dot { font-size: 0.65rem; padding: 1px 4px; }
  .cal-day-header { font-size: 0.65rem; }
}
