@import url("https://fonts.googleapis.com/css?family=Lato:400,400i,700,700i,900");
:root {
  --red:#ce2027;
  --red-hover:#b81d23;
  --white:#fff;
  --charcoal:#4a4a4a;
  --muted:#666;
  --line:#e6e6e6;
  --gray:#ebebeb;
}
* { box-sizing: border-box; }
body {
  margin:0; min-height:100vh;
  font-family:"Lato", Helvetica, Arial, sans-serif;
  background:var(--white); color:var(--charcoal);
  display:flex; flex-direction:column;
}
header.club {
  position:sticky; top:0; z-index:20;
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; padding:8px 16px;
  background:var(--white);
  border-bottom:1px solid var(--line);
  min-height:72px;
}
header.club img.logo { height:56px; width:auto; display:block; }
header.club .brand { text-align:right; }
header.club h1 { margin:0; font-size:1.15rem; font-weight:700; color:var(--red); text-transform:uppercase; }
header.club .sub { margin:2px 0 0; font-size:0.85rem; color:var(--muted); }
header.club .home-btn { width:auto; padding:8px 16px; margin-left:auto; flex:0 0 auto; }
h2 { margin:0 0 8px; font-size:1.05rem; font-weight:700; }
main { flex:1; width:min(560px,100%); margin:0 auto; padding:24px 20px 40px; }
main.app { width:min(1040px,100%); display:grid; grid-template-columns:1fr; gap:16px; }
@media (min-width:880px) {
  main.app { grid-template-columns:minmax(0,1.3fr) minmax(280px,0.9fr); align-items:start; }
}
.card { background:var(--white); border:1px solid var(--line); border-radius:8px; padding:22px 20px; }
.greet { font-size:1.05rem; margin:0 0 18px; }
.home-actions { display:flex; flex-direction:column; gap:10px; }
.btn {
  display:block; width:100%; border:0; border-radius:8px;
  padding:14px 16px; font-size:1rem; font-weight:700;
  cursor:pointer; background:var(--red); color:var(--white);
  text-align:center; text-decoration:none; font-family:inherit;
}
.btn:hover { background:var(--red-hover); }
.btn.secondary { background:var(--white); color:var(--red); border:2px solid var(--red); }
.btn.secondary:hover { background:var(--gray); }
.btn:disabled, .btn.gray, a.btn.gray {
  background:var(--gray); color:#999; border:2px solid #d4d4d4;
  cursor:not-allowed; pointer-events:none;
}
.alt { margin-top:22px; padding-top:18px; border-top:1px solid var(--line); }
.alt p { margin:0 0 10px; color:var(--muted); font-size:0.95rem; }
label { display:block; font-size:0.85rem; color:var(--muted); margin-bottom:6px; }
input[type="email"], input[type="text"], input[type="number"], input[type="date"], select, textarea {
  width:100%; border:1px solid var(--line); border-radius:8px;
  padding:12px 14px; font-size:1rem; margin-bottom:10px;
  background:var(--white); color:var(--charcoal); font-family:inherit;
}
textarea { min-height:140px; resize:vertical; }
.chips { display:flex; flex-wrap:wrap; gap:8px; margin:0 0 12px; }
.chip {
  border:1px solid var(--red); background:var(--white); color:var(--red);
  border-radius:999px; padding:8px 12px; font-size:0.9rem; font-weight:700;
  cursor:pointer; font-family:inherit;
}
.chip:hover { background:#fdecee; }
.datefield { display:flex; flex-direction:column; gap:4px; cursor:pointer; }
.datefield span { font-size:0.85rem; color:var(--muted); }
.row2 input, .row2 select { margin-bottom:0; }
.linkish { background:transparent; color:var(--red); border:1px solid var(--line); }
.note { margin:14px 0 0; color:var(--muted); font-size:0.85rem; line-height:1.4; }
footer {
  margin-top:auto; background:var(--red); color:var(--white);
  padding:18px 20px 28px; text-align:center; font-size:0.9rem; line-height:1.55;
}
footer a { color:var(--white); }
.flash { background:var(--gray); border:1px solid var(--line); border-radius:8px; padding:12px 14px; margin:0 0 14px; }
.flash.bad { border-color:var(--red); color:var(--red); }
.magic { background:var(--gray); border:1px dashed var(--line); border-radius:8px; padding:12px 14px; margin:0 0 14px; }
.magic a { color:var(--red); word-break:break-all; }
.who { color:var(--muted); font-size:0.85rem; margin-bottom:12px; }
.log { min-height:220px; max-height:52vh; overflow:auto; display:flex; flex-direction:column; gap:10px; padding-bottom:8px; }
.bubble { border-radius:12px; padding:10px 12px; line-height:1.45; max-width:92%; white-space:pre-wrap; }
.bubble.rachel { background:var(--gray); border:1px solid var(--line); align-self:flex-start; }
.bubble.user { background:var(--red); color:var(--white); align-self:flex-end; }
.choices { display:flex; flex-wrap:wrap; gap:8px; }
.choices button { width:auto; padding:10px 14px; }
.choices button.selected { box-shadow:0 0 0 2px var(--charcoal); }
.row2 { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.row3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:8px; align-items:end; }
.row3 input, .row3 select { margin-bottom:0; }
.err { color:var(--red); font-size:0.85rem; margin:0 0 8px; }
.panel ul { list-style:none; padding:0; margin:0 0 12px; }
.panel li { display:flex; justify-content:space-between; gap:12px; font-size:0.92rem; padding:6px 0; border-bottom:1px solid var(--line); }
.panel .tot { font-weight:700; }
.panel .empty { color:var(--muted); }
.chatrow { display:grid; grid-template-columns:1fr auto; gap:8px; margin-top:12px; align-items:center; }
.chatrow #chat { margin-bottom:0; }
.chatrow .btn { width:auto; padding:12px 16px; }

.bubble.thinking { opacity: 0.7; font-style: italic; }
.chatrow .btn:disabled { opacity: 0.7; cursor: wait; }
.chatrow #chat:disabled { opacity: 0.7; }

.line-label { display:inline-flex; align-items:center; gap:6px; }
.dollar-row { display:flex; align-items:center; gap:8px; }
.dollar-row input { margin-bottom:0; flex:1; }
.dollar-row .row2 { flex:1; min-width:0; }
.info-tip { position:relative; display:inline-flex; align-items:center; }
.info-i {
  width:18px; height:18px; padding:0; border-radius:50%;
  border:1px solid var(--muted); background:var(--white); color:var(--muted);
  font-size:11px; font-weight:700; font-style:italic; line-height:16px;
  font-family:Georgia, "Times New Roman", serif;
  cursor:help; flex:0 0 18px;
}
.info-i:hover, .info-tip:focus-within .info-i { border-color:var(--red); color:var(--red); }
.info-box {
  display:none; position:absolute; left:24px; top:50%; transform:translateY(-50%);
  width:220px; z-index:30;
  background:var(--charcoal); color:var(--white);
  border-radius:8px; padding:10px 12px;
  font-size:0.8rem; font-weight:400; font-style:normal; line-height:1.4;
  box-shadow:0 4px 14px rgba(0,0,0,0.18);
}
.info-tip:hover .info-box, .info-tip:focus-within .info-box { display:block; }
@media (max-width:879px) {
  .info-box { left:0; top:calc(100% + 6px); transform:none; }
}

.panel .area-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px 2px;
  margin: 0 0 12px;
}
.panel .area {
  margin: 0 0 4px;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--red);
}
.panel .subtot { font-weight: 700; color: var(--muted); }


/* View Budget + Fees Collected (do not restyle the rest of the app) */
body:has(main.budget-page:not(.budget-page-empty)) {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}
body:has(main.budget-page:not(.budget-page-empty)) header.club,
body:has(main.budget-page:not(.budget-page-empty)) footer {
  flex: 0 0 auto;
}
main.budget-page {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow: hidden;
}
main.budget-page.budget-page-empty {
  display: block;
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 24px 20px 40px;
  overflow: auto;
}
.budget-chat {
  flex: 0 0 20%;
  width: 20%;
  min-width: 240px;
  align-self: stretch;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 12px 16px;
  border-left: 1px solid var(--line);
  background: var(--white);
}
.budget-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.budget-chat-head h2 { margin: 0; font-size: 0.95rem; }
.budget-chat-head .chip { width: auto; padding: 6px 10px; font-size: 0.8rem; }
.budget-chat .who { margin-bottom: 4px; }
.budget-chat .log {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}
.budget-chat .chatrow,
.budget-chat .answer,
.budget-chat-chips,
.budget-chat-head,
.budget-chat .who { flex: 0 0 auto; }
.budget-chat .chatrow { margin-top: 8px; }
.suggested-h {
  margin: 8px 0 4px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  flex: 0 0 auto;
}
.budget-chat-chips { margin: 4px 0 0; }
.budget-main {
  flex: 1 1 80%;
  width: 80%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: auto;
  padding: 24px 20px 40px;
}
.budget-chat-show { display: none; width: auto; margin: 0 0 12px; }
main.budget-page.chat-collapsed .budget-chat { display: none; }
main.budget-page.chat-collapsed .budget-main { flex: 1 1 100%; width: 100%; }
main.budget-page.chat-collapsed .budget-chat-show { display: inline-flex; }
@media (max-width: 799px) {
  .budget-chat {
    position: fixed;
    right: 0;
    left: auto;
    top: 72px;
    bottom: 0;
    z-index: 15;
    width: min(86vw, 320px);
    max-width: 86vw;
    flex: none;
    height: auto;
    max-height: none;
    min-height: 0;
    box-shadow: -4px 0 18px rgba(0,0,0,0.12);
  }
  .budget-main { flex: 1 1 100%; width: 100%; }
}

.fees-h { font-weight: 900; margin: 0; color: var(--charcoal); }
.panel .fees-h { margin: 0 0 6px; }
.fees-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin: 8px 0 12px; }
.fees-table th, .fees-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.fees-table th { font-weight: 700; text-align: left; }
.fees-table th.num, .fees-table td.num, .budget-lines .num, .budget-foot .num { text-align: right; font-variant-numeric: tabular-nums; }
.fees-table tfoot td { font-weight: 700; }
.fees-table input { width: 100%; margin: 0; padding: 6px 8px; text-align: right; }
.expense-table { margin-top: 8px; }
details.area-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 0 0 12px;
  background: var(--white);
}
details.area-box > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
}
details.area-box > summary::-webkit-details-marker { display: none; }
details.area-box > summary .area {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--red);
}
details.area-box > summary .fees-h { font-size: 1rem; }
details.area-box > summary .sum { font-weight: 700; color: var(--charcoal); }
.budget-lines { list-style: none; padding: 8px 0 0; margin: 0; }
.budget-lines li {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 0.92rem; padding: 6px 0; border-bottom: 1px solid var(--line);
}
.budget-lines .subtot { font-weight: 700; color: var(--muted); }
.budget-foot { list-style: none; padding: 8px 0 0; margin: 16px 0 0; }
.budget-foot li {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 0.95rem; padding: 6px 0; border-bottom: 1px solid var(--line);
}
.budget-foot .tot { font-weight: 700; }
.team-pick { margin: 0 0 16px; }
.team-pick .btn { width: auto; display: inline-block; padding: 10px 16px; }
.panel .fees-table { font-size: 0.82rem; }
.panel .fees-table th, .panel .fees-table td { padding: 4px 6px; }

.fees-scroll { overflow-x: auto; }
.bav-sum { display: flex; gap: 14px; flex-wrap: wrap; justify-content: flex-end; font-size: 0.85rem; font-weight: 700; }
.bav-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin: 8px 0 0; }
.bav-table th, .bav-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.bav-table th { font-weight: 700; text-align: left; }
.bav-table th.num, .bav-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.bav-table tfoot td { font-weight: 700; }
.refund-cell { display: flex; gap: 4px; align-items: center; min-width: 140px; }
.refund-cell input { width: 80px; margin: 0; padding: 6px 8px; text-align: right; }
.refund-cell .btn { width: auto; padding: 6px 8px; font-size: 0.8rem; }
.split-box, .part-row { margin: 12px 0; }
.split-box .btn, .part-row input { max-width: 280px; }
.part-row input { width: 120px; }
.panel .bav-sum { font-size: 0.75rem; gap: 8px; justify-content: flex-start; margin: 0 0 6px; }
.panel .bav-table { font-size: 0.78rem; }
.panel .bav-table th, .panel .bav-table td { padding: 3px 4px; }


.chip.on { background: var(--red); color: var(--white); }
a.chip { text-decoration: none; display: inline-block; }

main.invoice-page { width: min(720px, 100%); }
.invoice-families { margin: 0 0 16px; }
.invoice-doc {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px 24px 32px;
  margin: 16px 0 0;
  color: var(--charcoal);
}
.invoice-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 3px solid var(--red);
  margin-bottom: 18px;
}
.invoice-logo { height: 64px; width: auto; display: block; }
.invoice-club { margin: 0 0 4px; font-size: 0.92rem; color: var(--muted); }
.invoice-doc h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--red);
  text-transform: uppercase;
}
.invoice-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 24px;
  margin: 0 0 18px;
}
.invoice-meta div { margin: 0; }
.invoice-meta dt {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.invoice-meta dd { margin: 2px 0 0; font-size: 1rem; font-weight: 700; }
.invoice-lines { width: 100%; border-collapse: collapse; margin: 0 0 16px; }
.invoice-lines th, .invoice-lines td {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.98rem;
}
.invoice-lines th { text-align: left; font-weight: 400; color: var(--charcoal); }
.invoice-lines td { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.invoice-lines tr.due th, .invoice-lines tr.due td {
  font-weight: 700;
  font-size: 1rem;
  color: var(--charcoal);
  border-bottom: 0;
  padding-top: 14px;
}
.invoice-lines tr.paycard th, .invoice-lines tr.paycard td {
  font-weight: 900;
  font-size: 1.08rem;
  color: var(--red);
  border-bottom: 0;
  padding-top: 14px;
}
.invoice-card-note {
  margin: 0 0 12px;
  font-size: 0.9rem;
  color: var(--muted);
}
.invoice-payee, .invoice-check { margin: 8px 0 0; font-size: 0.95rem; }
.invoice-payee { font-weight: 700; }
.invoice-schol { margin: 0 0 12px; font-weight: 700; color: var(--charcoal); }

.invoice-h {
  margin: 18px 0 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.invoice-h:first-of-type { margin-top: 0; }
.invoice-lines tr.sub th, .invoice-lines tr.sub td {
  font-weight: 900;
  border-bottom: 0;
  padding-top: 12px;
}
.invoice-cats { margin-bottom: 8px; }

@media print {
  header.club, footer, .invoice-chrome, .home-btn, .team-pick { display: none !important; }
  body { background: #fff; color: #4a4a4a; }
  main.invoice-page { width: 100%; max-width: none; margin: 0; padding: 0; }
  .invoice-doc { border: 0; border-radius: 0; margin: 0; padding: 0; }
  @page { margin: 0.6in; }
}
