/* Golfr Partners, Scorecard style: dark site, cream scorecard paper framed in powder blue, coral accent.
   Mobile first; wider screens get more columns. */
:root {
  --bg: #121212;
  --paper: #F2F0E6;
  --frame: #A0C3D9;
  --accent: #FF7689;
  --accent-ink: #b8394c;      /* coral dark enough to read as text on paper */
  --ink: #1d2a20;
  --ink-strong: #121212;
  --muted: rgba(29, 42, 32, 0.72);
  --rule: rgba(29, 42, 32, 0.14);
  --green: #2f7d4f;
  --on-dark-muted: rgba(242, 240, 230, 0.66);
  --display: 'Caprasimo', Georgia, serif;
  --body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--paper);
  font: 15px/1.5 var(--body);
  min-height: 100vh;
}

h1, h2, h3 { margin: 0; }
p { margin: 0 0 10px; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Layout ---------- */
.site { max-width: 980px; margin: 0 auto; padding: 16px 14px 48px; }
.narrow-site { max-width: 560px; }

.topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px; margin: 4px 6px 22px;
}
.logo { display: inline-flex; align-items: center; gap: 9px; font: 20px/1.1 var(--display); color: var(--paper); text-decoration: none; }
.ball {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, var(--paper) 45%, #d3cebd 100%);
  box-shadow: inset -2px -2px 0 rgba(0, 0, 0, 0.1);
}

#nav { display: flex; flex-wrap: wrap; gap: 6px; max-width: 100%; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  padding: 7px 11px; border-radius: 99px; border: 1px solid rgba(242, 240, 230, 0.2);
  background: transparent; color: var(--on-dark-muted); font-size: 13px; font-weight: 600; cursor: pointer;
}
.tab:hover { color: var(--paper); border-color: rgba(242, 240, 230, 0.45); }
.tab[aria-selected="true"] { background: var(--paper); color: var(--ink-strong); border-color: var(--paper); }

.loading { color: var(--on-dark-muted); text-align: center; padding: 48px 0; }
.foot { font-size: 12px; color: var(--on-dark-muted); text-align: center; margin: 0 8px 24px; }

/* ---------- Paper ---------- */
.paper {
  background: var(--paper); color: var(--ink);
  border-radius: 14px; padding: 16px;
  box-shadow: 0 0 0 6px var(--frame);
  margin: 6px 6px 30px;
}
.paper.narrow { max-width: 520px; margin-left: auto; margin-right: auto; }
.paper-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  border-bottom: 2px dashed rgba(29, 42, 32, 0.25); padding-bottom: 12px; margin-bottom: 14px;
}
.paper-title { font: 400 clamp(21px, 6vw, 27px)/1.15 var(--display); color: var(--ink-strong); }
.paper-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.small { font-size: 12.5px; color: var(--muted); }
.paper h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; margin-bottom: 8px; }

/* ---------- Influencer scorecard head + stamp ---------- */
.scorecard-head { align-items: flex-start; }
.who { flex: 1 1 200px; min-width: 0; }
.meta { margin: 4px 0 0; overflow-wrap: anywhere; }
.stamp {
  flex: none; margin: 4px 4px 0 auto;
  border: 3px solid var(--accent); color: var(--accent-ink);
  transform: rotate(-6deg); padding: 6px 12px; border-radius: 10px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-align: center; line-height: 1.2;
}
.stamp b { display: block; font: 400 22px/1.15 var(--display); letter-spacing: 0; margin-top: 2px; }

/* ---------- Boxes ---------- */
.boxes { display: grid; gap: 8px; margin: 4px 0 16px; }
.boxes-3 { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.45fr) minmax(0, 0.9fr); }
.boxes-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.boxes-5 .coral { grid-column: 1 / -1; }
.boxes-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ranges { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.range-btn {
  padding: 6px 12px; border-radius: 99px; border: 1.5px solid var(--ink-strong);
  background: transparent; color: var(--ink-strong); font: 600 13px/1.2 var(--body); cursor: pointer;
}
.range-btn:hover { background: var(--rule); }
.range-btn[aria-pressed="true"] { background: var(--ink-strong); color: var(--paper); }
.range-btn:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.box { border: 2px solid var(--ink-strong); border-radius: 12px; padding: 9px 4px; text-align: center; min-width: 0; }
.box .lab { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); font-weight: 700; line-height: 1.25; }
.box .num { font: 400 clamp(17px, 4.8vw, 26px)/1.25 var(--display); color: var(--ink-strong); overflow-wrap: anywhere; }
.box.coral { background: var(--accent); border-color: var(--accent); }
.box.coral .lab { color: var(--ink-strong); }

/* ---------- Milestones tier bar ---------- */
.tier-slot { margin: 4px 0 14px; }
.tb-cap { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; font-size: 14px; margin-bottom: 8px; }
.tb-cap b { font-weight: 700; color: var(--ink-strong); }
.tb-right { color: var(--muted); font-size: 12.5px; }
.tb-wrap { position: relative; padding: 34px 12px 0; }
.tb-track { position: relative; height: 8px; border-radius: 99px; background: rgba(29, 42, 32, 0.1); }
.tb-fill {
  position: absolute; inset: 0 auto 0 0; border-radius: 99px;
  background: linear-gradient(90deg, #ff9aa8, var(--accent)); box-shadow: 0 1px 6px rgba(255, 118, 137, 0.45);
}
.tb-mile {
  position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%;
  background: var(--paper); box-shadow: 0 0 0 2px rgba(29, 42, 32, 0.35);
}
.tb-mile.reached { background: var(--accent); box-shadow: 0 0 0 2px var(--accent-ink); }
.tb-knob {
  position: absolute; top: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, var(--paper) 45%, #d3cebd 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22), 0 0 0 3px var(--accent);
}
.tb-pill {
  position: absolute; top: -34px; transform: translateX(-50%);
  font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 99px; white-space: nowrap;
}
.tb-pill.next { background: var(--ink-strong); color: var(--paper); }
.tb-pill.later { background: rgba(29, 42, 32, 0.08); color: rgba(29, 42, 32, 0.8); }
.tb-ticks { position: relative; height: 18px; margin-top: 10px; font-size: 11px; color: var(--muted); }
.tb-ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.tb-ticks span.start { transform: none; }
.tb-ticks span.end { transform: translateX(-100%); }
.tb-ticks span.current { color: var(--ink-strong); font-weight: 700; }

.math { margin: -4px 0 12px; }

/* ---------- Score tables ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px 6px; padding: 0 4px; border-radius: 8px; }
table.score { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.months { min-width: 560px; }
table.team-table { min-width: 720px; }
.score thead th {
  background: var(--ink-strong); color: var(--paper); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.07em; padding: 8px 6px; text-align: center; font-weight: 700; white-space: nowrap;
}
.score thead th:first-child { text-align: left; border-radius: 8px 0 0 0; }
.score thead th:last-child { border-radius: 0 8px 0 0; }
.score td, .score tbody th, .score tfoot th {
  text-align: center; padding: 9px 6px; border-bottom: 1px solid var(--rule); white-space: nowrap;
}
.score tbody th, .score tfoot th { text-align: left; font-weight: 600; }
.score tbody th, .score thead th:first-child, .score tfoot th { position: sticky; left: 0; z-index: 1; }
.score tbody th, .score tfoot th { background: var(--paper); }
.score tr.sel td, .score tr.sel th { background: #fbe1df; }
.score tfoot td, .score tfoot th { border-bottom: 0; border-top: 2px solid var(--ink-strong); font-weight: 600; }
.score .codes { white-space: normal; min-width: 90px; font-size: 12px; }
.months tbody tr { cursor: pointer; }
.months tbody tr:hover td, .months tbody tr:hover th { background: rgba(255, 118, 137, 0.08); }
.months tbody tr.sel:hover td, .months tbody tr.sel:hover th { background: #fbe1df; }
.rowbtn { background: none; border: 0; padding: 0; font-weight: 600; cursor: pointer; text-decoration: underline; text-decoration-color: rgba(29, 42, 32, 0.25); text-underline-offset: 3px; }
.rowbtn[aria-pressed="true"] { text-decoration: none; }
.circle { display: inline-block; border: 2px solid var(--accent); border-radius: 50%; padding: 0 7px; font-weight: 700; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.status { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.st-so_far { color: var(--accent-ink); background: rgba(255, 118, 137, 0.15); }
.st-finalizing { color: #5d5a4c; background: rgba(29, 42, 32, 0.08); }
.st-due { color: #fff; background: var(--accent-ink); }
.st-paid { color: var(--green); background: rgba(58, 164, 101, 0.16); }
.st-nothing { color: #5d5a4c; background: transparent; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 2px solid var(--ink-strong); border-radius: 99px; padding: 7px 16px; min-height: 40px;
  background: var(--paper); color: var(--ink-strong); font-size: 13px; font-weight: 700;
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: #e7e4d6; }
.btn.dark { background: var(--ink-strong); color: var(--paper); }
.btn.dark:hover { background: #2a2a2a; }
.btn.coral { background: var(--accent); border-color: var(--accent); color: var(--ink-strong); }
.btn.small { min-height: 32px; padding: 3px 11px; font-size: 12px; }
.btn.icon { min-height: 34px; width: 34px; padding: 0; font-size: 18px; line-height: 1; }
.btn:disabled { opacity: 0.4; cursor: default; }
.linkbtn {
  background: none; border: 0; padding: 2px 0; color: var(--accent-ink); font-weight: 600; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; }

/* ---------- Lists, details, notes ---------- */
.lines { list-style: none; margin: 0; padding: 0; }
.lines li { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; padding: 7px 0; border-bottom: 1px solid var(--rule); }
.lines li:last-child { border-bottom: 0; }
.lines b { font-variant-numeric: tabular-nums; }

.notes { margin: 10px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--muted); }
.notes li { margin: 3px 0; }

.more-wrap { margin-top: 14px; display: grid; gap: 10px; }
details.more { border: 2px solid var(--rule); border-radius: 12px; padding: 0 12px; }
details.more summary {
  cursor: pointer; list-style: none; padding: 11px 0; font-weight: 700; font-size: 13.5px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; align-items: baseline;
}
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: '+'; font-weight: 700; color: var(--accent-ink); margin-left: auto; }
details.more[open] summary::after { content: '\2013'; }
details.more[open] { padding-bottom: 10px; }

.bars { list-style: none; margin: 0; padding: 0; }
.bars li { display: grid; grid-template-columns: 56px 1fr 28px; gap: 10px; align-items: center; font-size: 13px; padding: 4px 0; }
.bars-track { height: 10px; border-radius: 99px; background: rgba(29, 42, 32, 0.08); overflow: hidden; }
.bars-track i { display: block; height: 100%; border-radius: 99px; background: var(--frame); }
.bars li.best .bars-track i { background: var(--accent); }
.bars b { text-align: right; }

/* ---------- Team overview ---------- */
.live { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; color: var(--green); letter-spacing: 0.06em; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: #3aa465; box-shadow: 0 0 0 4px rgba(58, 164, 101, 0.2); }
.two { display: grid; grid-template-columns: 1fr; gap: 14px; margin: 14px 0 12px; }
.sub { border: 2px solid var(--rule); border-radius: 12px; padding: 12px; min-width: 0; }
.feed li { justify-content: flex-start; }
.feed time { color: var(--muted); width: 52px; flex: none; font-size: 12px; }
.feed .what { flex: 1; min-width: 0; }
.tag { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 99px; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; flex: none; }
.t-trial { background: rgba(160, 195, 217, 0.55); color: #1f3a4a; }
.t-paid { background: rgba(58, 164, 101, 0.2); color: var(--green); }
.t-code { background: rgba(255, 118, 137, 0.25); color: var(--accent-ink); }
.t-cancel { background: rgba(29, 42, 32, 0.1); color: var(--ink); }
.t-refund { background: var(--ink-strong); color: var(--paper); }

/* ---------- Influencers tab ---------- */
.switcher { display: inline-flex; align-items: center; gap: 8px; }
.switcher-label { font-weight: 700; min-width: 72px; text-align: center; }
.sub-block { margin-top: 18px; }

.editor { margin-top: 14px; border: 2px dashed var(--accent); border-radius: 12px; padding: 14px; background: #fff8f4; }
.editor-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; margin-bottom: 10px; }
.editor-head h3 { font: 700 15px/1.3 var(--body); text-transform: none; letter-spacing: 0; color: var(--ink-strong); margin: 0; }
.editor-foot .small { margin: 12px 0 0; }
.tier-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.1fr) auto; gap: 8px; align-items: center; font-size: 13px; }
.tier-grid .inp { width: 100%; }
.pct { display: flex; align-items: center; gap: 4px; }
.linkbtn.add { margin-top: 10px; }

/* ---------- Forms ---------- */
.stack { display: grid; gap: 10px; }
.stack label, .field label { font-weight: 600; font-size: 13px; }
.field { display: grid; gap: 4px; min-width: 0; }
.form-row { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 10px; }
.inp {
  border: 2px solid rgba(29, 42, 32, 0.28); border-radius: 8px; padding: 8px 10px; min-height: 40px;
  background: #fff; color: var(--ink); font-size: 16px; width: 100%;
}
.inp:focus { border-color: var(--ink-strong); outline: none; box-shadow: 0 0 0 3px rgba(255, 118, 137, 0.45); }
.inp.static { display: flex; align-items: center; background: rgba(29, 42, 32, 0.05); color: var(--muted); font-size: 14px; }
select.inp { appearance: auto; }
fieldset.radios { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
fieldset.radios legend { font-weight: 600; font-size: 13px; padding: 0; margin-bottom: 4px; width: 100%; }
.radio { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; min-height: 32px; }
.radio input { width: 18px; height: 18px; accent-color: var(--accent-ink); margin: 0; }

.msg { font-size: 13px; margin: 8px 0 0; min-height: 0; }
.msg:empty { margin: 0; }
.msg-ok { color: var(--green); font-weight: 600; }
.msg-error { color: var(--accent-ink); font-weight: 600; }

.people li { flex-wrap: wrap; justify-content: flex-start; }
.people .email { font-weight: 600; overflow-wrap: anywhere; flex: 1 1 180px; }
.people .scope { color: var(--muted); flex: 1 1 140px; font-size: 12.5px; }
.inf-list { list-style: none; margin: 0; padding: 0; }
.inf-list > li { border-bottom: 1px solid var(--rule); padding: 9px 0; }
.inf-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-size: 13px; }
.inf-row .codes { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.inf-row .small { flex: 1 1 160px; }
.inf-form { background: #fff8f4; border: 2px dashed var(--accent); border-radius: 12px; padding: 12px; margin-top: 4px; }

/* ---------- Warnings strip ---------- */
.warnings {
  background: #fff1ee; color: #5b1f29; border: 2px solid var(--accent); border-radius: 12px;
  padding: 12px 14px; margin: 6px 6px 22px; font-size: 13.5px;
}
.warnings-title { font-weight: 700; margin: 0 0 4px; }
.warnings ul { margin: 0; padding-left: 18px; }
.warnings li { margin: 3px 0; }

/* ---------- Dialog ---------- */
.dialog {
  border: 0; border-radius: 14px; padding: 18px; max-width: min(420px, calc(100vw - 32px));
  background: var(--paper); color: var(--ink); box-shadow: 0 0 0 6px var(--frame), 0 20px 50px rgba(0, 0, 0, 0.5);
}
.dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.dialog-title { font: 400 21px/1.2 var(--display); color: var(--ink-strong); margin-bottom: 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ---------- Phones (below 640px): no sideways scrolling for the main columns ---------- */
.more-line { display: none; }
.table-actions { justify-content: flex-start; margin-top: 4px; }
@media (max-width: 639px) {
  /* Team tabs and Sign out stay on one line. */
  #nav, .tabs { flex-wrap: nowrap; gap: 4px; }
  .tab { padding: 7px 9px; font-size: 12.5px; white-space: nowrap; }

  /* Score tables: secondary columns (.opt) move to a second line (.more-line) under each row. */
  table.months, table.team-table { min-width: 0; }
  .score .opt { display: none; }
  .score thead th { padding: 8px 4px; letter-spacing: 0.04em; }
  .score td, .score tbody th, .score tfoot th { padding: 9px 4px; }
  .score tr.has-more > * { border-bottom: 0; padding-bottom: 2px; }
  .score tr.more-line { display: table-row; }
  .score tr.more-line td { text-align: left; padding: 0 4px 9px; font-size: 12px; color: var(--muted); white-space: normal; }
  .status { padding: 2px 6px; }
  .team-table tbody th { white-space: normal; overflow-wrap: anywhere; }
  .team-table thead th:nth-last-child(2) { border-radius: 0 8px 0 0; }
  .more-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
  .more-actions { display: inline-flex; gap: 6px; }
}

/* ---------- Wider screens ---------- */
@media (min-width: 640px) {
  .site { padding: 24px 22px 56px; }
  .paper { padding: 22px; }
  .tab { padding: 7px 14px; }
  .box { padding: 10px; }
  .box .lab { font-size: 10px; letter-spacing: 0.08em; }
  .boxes-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .boxes-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .form-row { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end; }
}
@media (min-width: 820px) {
  .boxes-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
  .boxes-5 .coral { grid-column: auto; }
  .boxes-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .two { grid-template-columns: 1fr 1fr; }
  .box .num { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
