:root {
  --ink: #12303d; --muted: #5c7480; --line: #d9e4e8; --bg: #f5f9fa; --card: #fff;
  --brand: #0b6e7f; --brand-dark: #08525f; --accent: #f2a541;
  --ok: #2e7d4f; --warn: #b26a00; --err: #b3261e;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 1.2em 0 .5em; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.05rem; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 1.2rem; }
main.wrap { padding-bottom: 3rem; min-height: 60vh; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }

.demo-bar { background: var(--accent); color: #3a2500; text-align: center; font-size: .85rem; padding: .35rem 1rem; }
.demo-bar a { color: inherit; font-weight: 600; }

.site-header { background: var(--brand-dark); color: #fff; }
.header-inner { display: flex; align-items: center; gap: 1rem; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .55rem; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.2rem; }
.brand svg { width: 34px; height: 34px; color: var(--accent); }
.main-nav { display: flex; align-items: center; gap: .25rem; margin-left: auto; flex-wrap: wrap; }
.main-nav a { color: #d7eef2; text-decoration: none; padding: .4rem .55rem; border-radius: 6px; font-size: .93rem; }
.main-nav a:hover, .main-nav a.active { background: rgba(255,255,255,.12); color: #fff; }
.main-nav .btn { color: #3a2500; background: var(--accent); }
.nav-sep { width: 1px; height: 22px; background: rgba(255,255,255,.25); margin: 0 .3rem; }
.nav-toggle, .nav-burger { display: none; }
.badge { background: var(--accent); color: #3a2500; border-radius: 10px; padding: 0 .45rem; font-size: .75rem; font-weight: 700; }

.role-bar { font-size: .9rem; padding-top: .6rem; color: var(--muted); }
.role-bar form { background: #e6f3f5; border: 1px solid #c4e2e7; border-radius: 8px; padding: .4rem .8rem; display: inline-block; }

.btn { display: inline-block; background: var(--brand); color: #fff; border: 0; border-radius: 8px; padding: .6rem 1.1rem; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--brand-dark); }
.btn-ghost { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); }
.btn-ghost:hover { background: #e6f3f5; }
.btn-small { padding: .35rem .75rem; font-size: .9rem; }
.btn-danger { background: var(--err); }
.btn-danger:hover { background: #8c1d17; }
.linkish { background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; cursor: pointer; font: inherit; }
.linkish.danger { color: var(--err); }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; }

.flash { padding: .7rem 1rem; border-radius: 8px; margin: 1rem 0; border: 1px solid; }
.flash-ok { background: #e8f5ec; border-color: #b6dcc2; color: #1d5434; }
.flash-warn { background: #fff4e0; border-color: #f0d29c; color: #6a4300; }
.flash-err { background: #fdecea; border-color: #f2b8b3; color: #7d1a14; }
.flash-demo { background: #eef0ff; border-color: #c7ccf5; color: #2f357a; font-size: .92rem; }
.note { background: #e6f3f5; border-left: 4px solid var(--brand); padding: .7rem 1rem; border-radius: 0 8px 8px 0; }

.hero { margin: 1.5rem 0 2rem; border-radius: 16px; padding: 3rem 2rem; color: #fff;
  background: linear-gradient(160deg, rgba(8,82,95,.92), rgba(11,110,127,.75)), radial-gradient(circle at 80% 120%, #2bb3c0 0, transparent 55%), #0b6e7f; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 60px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 60' preserveAspectRatio='none'%3E%3Cpath d='M0 30 Q150 0 300 30 T600 30 T900 30 T1200 30 V60 H0Z' fill='%23ffffff' fill-opacity='.12'/%3E%3C/svg%3E") bottom/100% 100% no-repeat; }
.hero h1 { font-size: 2.4rem; margin-top: 0; }
.hero-text { max-width: 620px; position: relative; z-index: 1; }
.hero .btn-ghost { color: #fff; border-color: #fff; }
.hero .btn-ghost:hover { background: rgba(255,255,255,.12); }
.hero .btn { margin: .3rem .3rem 0 0; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; }
.event-grid { grid-template-columns: 1.6fr 1fr; }
.card, .panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.3rem; }
.card h3, .panel h2:first-child, .panel h1:first-child { margin-top: 0; }
.panel.narrow { max-width: 520px; margin: 2rem auto; }
.panel.medium { max-width: 760px; margin: 1.5rem auto; }
.panel + .panel { margin-top: 1rem; }
.grid-2 .panel + .panel { margin-top: 0; }
.prose { max-width: 760px; }
.levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.levels p { margin-bottom: 0; }

.form { display: grid; gap: .9rem; }
.form label { display: grid; gap: .3rem; font-weight: 600; font-size: .95rem; }
.form label .muted { font-weight: 400; }
.form label.inline { display: inline-flex; align-items: center; gap: .4rem; font-weight: 400; margin-right: 1rem; }
input, select, textarea { font: inherit; padding: .55rem .7rem; border: 1px solid #b9cbd1; border-radius: 7px; background: #fff; width: 100%; color: var(--ink); }
input[type=radio], input[type=checkbox] { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid #8fd0da; border-color: var(--brand); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: .95rem; margin-bottom: .3rem; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .9rem; }
.row-form { grid-template-columns: 1fr auto; align-items: end; }
.form .btn { justify-self: start; }
.inline-form { display: inline; }

.page-title { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-top: 1rem; }
.cal-head h2 { margin: 0; }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: .8rem; }
.cal-dow { text-align: center; font-size: .8rem; font-weight: 700; color: var(--muted); padding: .2rem; }
.cal-day { background: #fff; border: 1px solid var(--line); border-radius: 6px; min-height: 92px; padding: .3rem; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal-empty { background: transparent; border-color: transparent; }
.cal-today { border: 2px solid var(--accent); }
.cal-num { font-size: .8rem; color: var(--muted); font-weight: 600; }
.cal-event { display: block; font-size: .78rem; background: #e0f0f3; color: var(--brand-dark); border-radius: 4px; padding: 2px 5px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event span { font-weight: 700; }
.cal-event:hover { background: #c9e6eb; }
.cal-mine { background: var(--brand); color: #fff; }
.cal-mine:hover { background: var(--brand-dark); }
.cal-cancelled { background: #f3e4e3; color: #8a3a35; text-decoration: line-through; }
.legend { font-size: .85rem; color: var(--muted); display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; margin-left: .6rem; }
.sw-mine { background: var(--brand); } .sw-cancel { background: #f3e4e3; border: 1px solid #d9b0ac; }

.event-list { display: grid; gap: .5rem; }
.event-row { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem 1rem; text-decoration: none; color: inherit; }
.event-row:hover { border-color: var(--brand); }
.event-row.is-cancelled { opacity: .65; }
.event-row .right { text-align: right; display: grid; gap: .25rem; justify-items: end; }
.date-chip { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 8px; background: #e6f3f5; color: var(--brand-dark); font-size: .75rem; text-transform: uppercase; line-height: 1.1; }
.date-chip b { font-size: 1.3rem; }
.spots { font-size: .82rem; color: var(--muted); }

.level { display: inline-block; font-size: .75rem; font-weight: 700; padding: .12rem .55rem; border-radius: 20px; background: #e9eef0; color: #3d5560; text-transform: uppercase; letter-spacing: .03em; }
.level-easy { background: #dff3e6; color: #1f6a3c; }
.level-moderate { background: #fff0d6; color: #8a5300; }
.level-advanced { background: #fde2e0; color: #9a2a22; }
.level-social { background: #ece5fb; color: #523a8f; }
.level-training { background: #dfecfb; color: #234f86; }
.tag { display: inline-block; font-size: .75rem; padding: .05rem .5rem; border-radius: 5px; background: #e9eef0; color: #3d5560; font-weight: 600; vertical-align: middle; }
.tag-ok { background: #dff3e6; color: #1f6a3c; } .tag-warn { background: #fff0d6; color: #8a5300; } .tag-err { background: #fde2e0; color: #9a2a22; }

.event-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.event-head h1 { margin-top: .3rem; }
.event-meta { color: var(--muted); margin-top: 0; }
.actions { display: flex; gap: .5rem; margin-top: .5rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; margin: 0 0 1rem; }
.facts dt { font-weight: 700; color: var(--muted); }
.facts dd { margin: 0; }
.people { padding-left: 1.2rem; }
.people li { margin-bottom: .35rem; }
.people .muted { font-size: .85rem; margin-left: .3rem; }
.manage { margin-top: 1.5rem; border-color: #f0d29c; background: #fffaf0; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin: 1rem 0; }
.stats div { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; color: var(--muted); font-size: .85rem; }
.stats b { display: block; font-size: 1.6rem; color: var(--ink); }
.tabs { display: flex; gap: .3rem; border-bottom: 2px solid var(--line); margin: 1rem 0; }
.tabs a { padding: .5rem 1rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; font-weight: 600; }
.tabs a.active { color: var(--brand); border-color: var(--brand); }
.applicant { display: grid; grid-template-columns: 1fr auto; gap: .6rem 1rem; align-items: start; }
.applicant > form:last-child { grid-column: 2; justify-self: end; }
.quote { background: var(--bg); border-radius: 6px; padding: .5rem .8rem; margin: .5rem 0 0; font-size: .92rem; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.table th, .table td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--line); font-size: .92rem; }
.table th { background: #eef4f6; }
.table select { width: auto; padding: .25rem .4rem; }
ul.plain { list-style: none; padding: 0; }
ul.plain li { padding: .35rem 0; border-bottom: 1px solid var(--line); }

.mail-list { display: grid; gap: .5rem; }
.mail { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.mail summary { padding: .7rem 1rem; cursor: pointer; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.mail summary .muted { margin-left: auto; font-size: .85rem; }
.mail pre { margin: 0; padding: 1rem; border-top: 1px solid var(--line); white-space: pre-wrap; font: .9rem/1.5 ui-monospace, Menlo, Consolas, monospace; background: #fbfdfd; }

.site-footer { background: #0d2b35; color: #b9cdd3; padding: 1.5rem 0; font-size: .9rem; }
.site-footer a { color: #fff; }
.site-footer p { margin: .2rem 0; }
.site-footer .muted { color: #86a1a9; }

/* Printable sign-on sheet */
.print-page { background: #fff; padding: 1.5rem; max-width: 1000px; margin: 0 auto; }
.print-page h1 { margin-top: 0; font-size: 1.4rem; }
.sheet-head, .sheet { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
.sheet-head th, .sheet-head td, .sheet th, .sheet td { border: 1px solid #555; padding: .45rem .5rem; text-align: left; font-size: .9rem; }
.sheet-head th { width: 90px; background: #f0f0f0; }
.sheet td { height: 2.2rem; }
.sheet th { background: #f0f0f0; }
@media print { .no-print { display: none; } .print-page { padding: 0; } }

@media (max-width: 860px) {
  .grid-3, .levels, .grid-2, .event-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .nav-burger { display: block; margin-left: auto; font-size: 1.6rem; cursor: pointer; padding: .2rem .5rem; }
  .main-nav { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: .8rem; }
  .nav-toggle:checked ~ .main-nav { display: flex; }
  .nav-sep { width: 100%; height: 1px; margin: .3rem 0; }
  .calendar { gap: 2px; }
  .cal-day { min-height: 60px; padding: 2px; }
  .cal-event { font-size: 0; padding: 0; height: 7px; border-radius: 4px; }
  .cal-event span { display: none; }
  .hero { padding: 2rem 1.3rem; } .hero h1 { font-size: 1.8rem; }
  .event-row { grid-template-columns: auto 1fr; }
  .event-row .right { grid-column: 1 / -1; justify-items: start; text-align: left; display: flex; gap: .6rem; }
  .applicant { grid-template-columns: 1fr; }
  .applicant > form:last-child { grid-column: 1; justify-self: start; }
  .row-form { grid-template-columns: 1fr; }
}
.hero .btn:not(.btn-ghost) { background: var(--accent); color: #3a2500; }
.hero .btn:not(.btn-ghost):hover { background: #f7b863; }

/* Grades */
.grade-1 { background: #dff3e6; color: #1f6a3c; }
.grade-2 { background: #e3f0fb; color: #22508a; }
.grade-3 { background: #fff0d6; color: #8a5300; }
.grade-4 { background: #fde2e0; color: #9a2a22; }
.grade-5 { background: #2d2d2d; color: #fff; }
.tag-muted { background: #eef1f2; color: #7a8c93; font-weight: 500; }
.grade-note { background: #fff8eb; border: 1px solid #f0d29c; border-radius: 8px; padding: .7rem .9rem; margin-bottom: .9rem; font-size: .93rem; }
.grade-note p { margin: .2rem 0; }
.requests { background: #fff8eb; border: 1px solid #f0d29c; border-radius: 8px; padding: .3rem .9rem .8rem; margin-top: 1rem; }
.requests h3 { margin-top: .6rem; }
.request { padding: .5rem 0; border-top: 1px solid #f0e0bd; }
.request:first-of-type { border-top: 0; }
.request .btn-row { margin-top: .4rem; }
.role-bar form + form { margin-left: .5rem; }
.mini-select { width: auto; padding: .1rem .3rem; font-size: .88rem; }
.grade-pick { display: inline-flex; align-items: center; gap: .3rem; font-size: .9rem; font-weight: 600; }
.grade-pick select { width: auto; padding: .3rem .4rem; }
.applicant .btn-row { align-items: center; }
.form label.inline.block { display: flex; margin: .2rem 0; }
.grade-table input.num { width: 5rem; }
.grade-table td { vertical-align: top; }
.new-row td { background: #f7fbfc; }
