:root {
  /* --navy/--navy-light now hold the sage-green palette (names kept as-is
     so every existing rule that references them picks up the new color
     without having to be touched individually). */
  --navy: #3f5643;
  --navy-light: #6f8c6a;
  --bg: #f3f1e9;
  --card: #fdfbf6;
  --border: #ddd8c8;
  --text: #262420;
  --muted: #746f5f;
  --accent: #c9a13b;
  --good: #2e7d4f;
  --warn: #b45309;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.topbar {
  background: var(--navy);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  flex-wrap: wrap;
  gap: 10px;
  /* menu stays visible at the top while you scroll */
  position: sticky;
  top: 0;
  z-index: 100;
}
html { scroll-padding-top: 70px; }  /* jump links (#sched etc.) don't hide under the menu */
.topbar .brand { color: white; font-weight: 700; text-decoration: none; font-size: 1.1rem; }
.topbar nav a { color: #e6e2d0; text-decoration: none; margin-left: 18px; font-size: 0.92rem; }
.topbar nav a:hover { color: var(--accent); }
.topbar nav a.backbtn { border: 1px solid #e6e2d0; border-radius: 6px; padding: 3px 12px; margin-left: 16px; font-weight: 600; }
.topbar nav a.backbtn:hover { border-color: var(--accent); }
.navmenu { display: inline-block; position: relative; margin-left: 18px; }
.navmenu summary { color: #e6e2d0; font-size: 0.92rem; cursor: pointer; list-style: none; }
.navmenu summary::-webkit-details-marker { display: none; }
.navmenu summary:hover, .navmenu[open] summary { color: var(--accent); }
.navmenu-items { position: absolute; top: 100%; left: -10px; z-index: 50; margin-top: 8px; min-width: 190px;
  background: var(--navy); border: 1px solid var(--navy-light); border-radius: 6px; padding: 6px 0; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.navmenu-items a { display: block; margin: 0; padding: 8px 16px; white-space: nowrap; }
.container { max-width: 1000px; margin: 0 auto; padding: 24px 16px 60px; }
h1 { font-size: 1.5rem; margin: 0 0 4px; font-weight: 700; }
h2 {
  font-size: 1.15rem;
  margin: 28px 0 10px;
  color: var(--navy);
  font-weight: 700;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--accent);
}
h3 { font-size: 1rem; margin: 18px 0 8px; color: var(--navy); font-weight: 700; }
.muted { color: var(--muted); font-size: 0.9rem; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 16px;
}
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:hover td { background: #fafbfc; }
a { color: var(--navy-light); }
.btn {
  display: inline-block;
  background: var(--navy);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
  text-decoration: none;
}
.btn:hover { background: var(--navy-light); }
.btn.secondary { background: white; color: var(--navy); border: 1px solid var(--navy); }
.btn.danger { background: white; color: #b3261e; border: 1px solid #b3261e; }
.btn.danger:hover { background: #b3261e; color: white; }
form.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
input, select, textarea {
  padding: 7px 9px;
  border: 1px solid #c6c1a8;
  border-radius: 5px;
  font-size: 0.9rem;
  font-family: inherit;
  background: #f1eee2;
  color: var(--text);
}
input:hover, select:hover, textarea:hover {
  border-color: #a39d80;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--navy-light);
  box-shadow: 0 0 0 3px rgba(111, 140, 106, 0.25);
}
input::placeholder, textarea::placeholder {
  color: #9c977f;
}
label { font-size: 0.85rem; font-weight: 700; color: var(--navy); display: block; margin-bottom: 3px; }
.field { margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eae5d5;
  color: var(--navy);
}
.badge.good { background: #e6f4ea; color: var(--good); }
.badge.warn { background: #fdf1e0; color: var(--warn); }
.flash {
  background: #fff8e1;
  border: 1px solid #f0d98c;
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.stat-row { display: flex; gap: 16px; flex-wrap: wrap; margin: 16px 0; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 14px 20px; min-width: 140px; }
.stat .num { font-size: 1.6rem; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.stat .label { font-size: 0.8rem; color: var(--muted); }

/* Long lists: column headings stay in view under the menu bar while you scroll */
table.sticky-head th { position: sticky; top: 56px; background: #efe6c4; color: var(--navy); z-index: 50;
  box-shadow: 0 1px 0 var(--border); font-weight: 800; padding-top: 10px; padding-bottom: 10px; border-bottom: 3px solid var(--accent, #c9a14a); }
table.sticky-head th:first-child { border-top-left-radius: 6px; }
table.sticky-head th:last-child { border-top-right-radius: 6px; }
tr.band td { background: rgba(190, 170, 110, 0.10); }
.roster-find { margin: 0 0 10px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.roster-find input { width: 260px; }

/* Phones: menus open in the middle of the screen so they are easy to see and tap */
@media (max-width: 700px) {
  .navmenu-items {
    position: fixed !important; top: 50% !important; left: 50% !important; right: auto !important;
    transform: translate(-50%, -50%); margin-top: 0 !important;
    width: min(88vw, 340px); max-height: 80vh; overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,.45);
  }
  .navmenu-items a { padding: 14px 18px; font-size: 1.05rem; }
}

/* Programs list: tidy name + status pill */
a.prog-name { font-weight: 700; font-size: 1.02rem; color: var(--navy); text-decoration: none; margin-right: 8px; }
a.prog-name:hover { text-decoration: underline; }
.pill { display: inline-block; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.02em; padding: 2px 9px; border-radius: 999px; white-space: nowrap; vertical-align: middle; }
.pill-go { background: #e3efe5; color: #2f5a3a; }
.pill-dev { background: #f6ead2; color: #8a5200; }
.prog-desc { margin-top: 3px; }
th.num, td.num { text-align: center; width: 1%; white-space: nowrap; }

/* Phone header: brand on the left, Back and Log Out on the right, menu links centered on their own row */
@media (max-width: 700px) {
  .topbar { padding: 12px 16px; gap: 8px 10px; }
  .topbar .brand { order: 1; flex: 1 1 auto; }
  .topbar > a.backbtn { order: 2; margin-left: 0 !important; }
  .topbar > .account-menu { order: 3; margin-left: 4px; }
  .topbar nav { order: 4; flex: 1 1 100% !important; display: flex; flex-wrap: wrap; justify-content: center;
    gap: 10px 22px; padding-top: 10px; align-items: center; border-top: 1px solid rgba(230,226,208,.25); }
  .topbar nav a, .topbar nav .navmenu { margin-left: 0 !important; }
  .topbar nav a, .navmenu summary { font-size: 1rem; }
  .topbar nav .navmenu { display: block; line-height: 1.2; }
  .topbar nav a { line-height: 1.2; }
  table th, table td { padding: 10px 8px; }
}

/* ---- Team pages on a phone: one rule set that keeps every page inside the screen ---- */
@media (max-width: 700px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  .container { padding: 14px 12px 50px; }
  h1 { font-size: 1.35rem; }
  .card { padding: 14px 12px; }
  /* wide tables scroll sideways inside their own box instead of stretching the page */
  table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.sticky-head th { position: static; }
  /* two-column layouts stack */
  .grid2 { grid-template-columns: 1fr; }
  [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  [style*="display:flex"], [style*="display: flex"] { flex-wrap: wrap; }
  /* inputs fit the screen and are 16px so iPhones do not zoom in */
  input, select, textarea { font-size: 16px; max-width: 100%; }
  input[style*="width"], select[style*="width"], textarea[style*="width"],
  input[style*="min-width"], select[style*="min-width"], textarea[style*="min-width"] { width: 100% !important; min-width: 0 !important; }
  form.inline input:not([type=checkbox]):not([type=radio]), form.inline select { flex: 1 1 140px; }
  .roster-find input { width: 100%; }
  [style*="max-width:"] { max-width: 100% !important; }
  .btn { padding: 10px 14px; }
  .stat { min-width: 0; flex: 1 1 130px; padding: 12px 14px; }
  img, video, iframe, canvas { max-width: 100%; height: auto; }
  pre, code { white-space: pre-wrap; word-break: break-word; }
  .navmenu-items { max-width: 92vw; }
}

/* Phone: tables marked class="stack" turn each row into a small card */
@media (max-width: 700px) {
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; box-sizing: border-box; }
  table.stack tr:first-child { display: none; }
  table.stack tr { border-bottom: 1px solid #d9d2c0; padding: 10px 0; }
  table.stack td { border: 0; padding: 2px 0; }
  table.stack td[data-label]::before { content: attr(data-label) ": "; color: #6b6b5e; font-weight: 400; }
  table.stack td:last-child { padding-top: 8px; }
}
@media (max-width: 700px) { table.stack td[style*="nowrap"] { white-space: normal !important; } }
@media (max-width: 700px) { table.stack td.ph { display: none; } }
@media (max-width: 700px) { table.stack thead { display: none; } }
@media (max-width: 700px) { table.stack td:empty { display: none; } }
/* Phone: number tables shrink to fit instead of running off the screen */
@media (max-width: 700px) {
  table.compact { display: table; width: 100%; table-layout: auto; font-size: .82rem; }
  table.compact th, table.compact td { padding: 6px 3px; letter-spacing: 0; font-size: .72rem; word-break: break-word; }
  table.compact td { font-size: .85rem; }
  table.compact th:first-child, table.compact td:first-child { width: 28%; }
}
@media (max-width: 700px) { table.stack.nohead tr:first-child { display: block; } table.stack.nohead td { word-break: break-word; } table.stack.nohead tr { border-bottom: 0; padding: 4px 0; } }
@media (max-width: 700px) { #qs-form select, #qs-form input[type=date] { flex: 1 1 100%; width: 100%; box-sizing: border-box; min-height: 44px; } }
@media (max-width: 700px) {
  form.datesform { display: block; }
  form.datesform label { display: block; margin-top: 10px !important; }
  form.datesform input[type=date], form.datesform input[type=text] { width: 100% !important; box-sizing: border-box; min-height: 44px; }
  form.datesform .btn { margin-top: 12px; }
  table.stack td select { max-width: 100% !important; }
  table.stack td[data-label="Actions"]::before, table.stack td[data-label="Paid"]::before { display: block; margin-bottom: 4px; }
}

/* Big full-width section bands (session page: Trainee Roster, Session Team) */
h2.bandhead {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px;
  width: 100%; box-sizing: border-box;
  background: #44564a; color: #fff;
  font-size: 2.1rem; font-weight: 800; letter-spacing: .02em;
  padding: 16px 22px; margin: 36px 0 14px;
  border: 0; border-left: 10px solid #c9a13b; border-radius: 8px;
}
h2.bandhead a:not(.btn) { color: #ffe08a !important; margin-left: 0 !important; font-size: 1.1rem !important; }
@media (max-width: 700px) { h2.bandhead { font-size: 1.6rem; padding: 14px 16px; } }

/* The two session-page sections are dropdowns */
details.bandsec { margin: 0; }
details.bandsec > summary.bandhead { cursor: pointer; list-style: none; position: relative; padding-left: 52px; }
details.bandsec > summary.bandhead::-webkit-details-marker { display: none; }
details.bandsec > summary.bandhead::before { content: "\25B8"; position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: #ffe08a; }
details.bandsec[open] > summary.bandhead::before { content: "\25BE"; }
summary.bandhead { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; width: 100%; box-sizing: border-box;
  background: #44564a; color: #fff; font-size: 2.1rem; font-weight: 800; letter-spacing: .02em;
  padding: 16px 22px 16px 52px; margin: 36px 0 14px; border-left: 10px solid #c9a13b; border-radius: 8px; }
summary.bandhead .bandcnt { font-size: 1.2rem; font-weight: 500; color: #d9e3d6; }
summary.bandhead a:not(.btn) { color: #ffe08a !important; margin-left: 0 !important; font-size: 1.1rem !important; }
@media (max-width: 700px) { summary.bandhead { font-size: 1.6rem; padding: 14px 14px 14px 46px; } }
