:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --ink: #1c2418;
  --muted: #6b7566;
  --line: #dfe3d9;
  --green: #2f6b3a;
  --green-dark: #24522d;
  --amber: #b7791f;
  --red: #a5342b;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

main { max-width: 960px; margin: 0 auto; padding: 24px 20px 64px; }

h1 { font-size: 26px; margin: 0 0 18px; }
h2 { font-size: 17px; margin: 0 0 14px; }
p { margin: 0 0 10px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 600; color: var(--ink); text-decoration: none; }
.strong:hover { text-decoration: underline; }
.hint { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 400; }

/* header */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 24px; background: var(--green); color: #fff;
}
.topbar .brand { color: #fff; font-weight: 600; text-decoration: none; font-size: 17px; }
.topbar .ball { color: #d8e8c8; }
.topbar nav { display: flex; gap: 14px; align-items: center; }
.topbar nav a { color: #eaf2e4; text-decoration: none; font-size: 14px; }
.topbar nav a:hover { color: #fff; }
.topbar nav a.btn-primary { color: var(--green-dark); }

/* banners */
.banner {
  max-width: 960px; margin: 16px auto 0; padding: 11px 16px;
  border-radius: var(--radius); font-size: 14px;
}
.banner.warn { background: #fdf5e2; border: 1px solid #ecd9a5; color: #6b5310; }
.banner.error { background: #fdeceb; border: 1px solid #f0c2bd; color: var(--red); }
.banner.success { background: #e9f4ea; border: 1px solid #b9dcbe; color: var(--green-dark); }
.banner code { background: rgba(0,0,0,.06); padding: 1px 4px; border-radius: 3px; }

/* cards & forms */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px;
}
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 22px; }
.card.stat { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; margin: 0; }
.card.stat .label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

label { display: block; margin-bottom: 14px; font-weight: 500; font-size: 14px; }
label.inline { display: inline-flex; align-items: center; gap: 7px; margin-right: 18px; font-weight: 400; }
input[type=text], input[type=password], input[type=date], input[type=time],
input[type=number], input:not([type]), select {
  width: 100%; margin-top: 5px; padding: 8px 10px; font-size: 14px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: 2px solid #bcd6c0; outline-offset: -1px; border-color: var(--green); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.row { display: flex; gap: 8px; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; }
legend { font-weight: 500; font-size: 14px; padding: 0 0 8px; }

.modes { display: grid; gap: 10px; }
.mode-choice {
  display: flex; gap: 11px; align-items: flex-start; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; font-weight: 400;
}
.mode-choice:has(input:checked) { border-color: var(--green); background: #f2f8f2; }
.mode-choice input { margin-top: 3px; }
.mode-choice p { margin: 3px 0 0; font-size: 13px; color: var(--muted); }

.courses { margin-top: 14px; display: grid; gap: 8px; }
.course-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: center;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfa;
}
.course-row select { margin-top: 0; }

/* buttons */
.btn {
  display: inline-block; padding: 8px 14px; font-size: 14px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink);
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: #f0f2ed; }
.btn-primary { background: #fff; border-color: transparent; font-weight: 600; }
main .btn-primary, .form-actions .btn-primary { background: var(--green); color: #fff; border-color: var(--green); }
main .btn-primary:hover { background: var(--green-dark); }
.btn-danger { color: var(--red); border-color: #eccbc7; }
.btn-danger:hover { background: #fdeceb; }
.btn-small { padding: 5px 10px; font-size: 13px; }
.form-actions { display: flex; gap: 10px; align-items: center; }

/* tables */
table { width: 100%; border-collapse: collapse; background: var(--surface);
        border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
     color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); font-weight: 600; }
td { padding: 11px 14px; border-bottom: 1px solid #eef0ea; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.actions { white-space: nowrap; }
td.actions form { margin: 0 0 5px; }
.logs td.ts { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; width: 140px; }
.logs .log-hit td { background: #f0f7f1; font-weight: 500; }
.logs .log-error td { background: #fdf1f0; color: var(--red); }

/* pills */
.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px;
  font-weight: 600; background: #eceee8; color: var(--muted); text-transform: lowercase;
}
.status-success { background: #dff0e1; color: var(--green-dark); }
.status-searching { background: #e2ecf7; color: #22558c; }
.status-error { background: #fadedb; color: var(--red); }
.mode-book { background: #dff0e1; color: var(--green-dark); }
.mode-hold { background: #fdf0d8; color: var(--amber); }
.mode-notify { background: #e6eaf2; color: #4a5670; }
.dry { background: #ece4f6; color: #5b3f86; }
.off { background: #e6e6e6; color: #666; }

.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 20px; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-actions form { margin: 0; }
.empty { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
         padding: 40px; text-align: center; }

@media (max-width: 640px) {
  .grid, .course-row { grid-template-columns: 1fr; }
  .detail-head { flex-direction: column; }
}

.inline-warn {
  margin-top: 12px; padding: 10px 13px; font-size: 13px; line-height: 1.45;
  background: #fdf5e2; border: 1px solid #ecd9a5; border-radius: 8px; color: #6b5310;
}

.consent {
  margin-top: 4px; padding: 13px 15px; border: 1px solid var(--line);
  border-radius: 8px; background: #fbfcfa;
}
.consent-check { align-items: flex-start; margin: 0 0 8px; font-weight: 400; }
.consent-check input { margin-top: 3px; flex: 0 0 auto; }
.consent-terms { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.consent-terms a { color: var(--green); }

.auth-card {
  max-width: 380px; margin: 48px auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 26px;
}
.auth-card h1 { font-size: 21px; margin-bottom: 16px; }
.auth-card .btn-primary { width: 100%; margin-top: 6px; }
.auth-card p:last-child { margin-top: 16px; margin-bottom: 0; }
.whoami { color: #d8e8c8; font-size: 13px; text-decoration: none; }
.whoami:hover { color: #fff; text-decoration: underline; }
.logout { margin: 0; }
.logout .btn { background: transparent; color: #eaf2e4; border-color: rgba(255,255,255,.35); }
.logout .btn:hover { background: rgba(255,255,255,.12); }
