:root {
  --ink: #142b3b;
  --ink-soft: #3e5361;
  --muted: #73828a;
  --line: #e2e8e9;
  --paper: #f4f7f6;
  --white: #ffffff;
  --teal: #087e83;
  --teal-dark: #05666d;
  --teal-pale: #e6f3f1;
  --gold: #c68c35;
  --gold-pale: #fbf2e4;
  --red: #a64742;
  --red-pale: #fff0ee;
  --shadow: 0 12px 38px rgba(18, 42, 54, .065);
}
* { box-sizing: border-box; }
html { background: var(--paper); scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); font-family: 'DM Sans', sans-serif; font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled, input:disabled, select:disabled { cursor: not-allowed; opacity: .56; }
.page-shell { max-width: 1200px; margin: 0 auto; padding: 0 34px 42px; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 24px 0 21px; border-bottom: 1px solid #dfe6e5; }
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 39px; height: 39px; display: grid; place-items: center; background: var(--ink); color: #fff; border-radius: 12px 12px 12px 3px; font: 800 20px 'Manrope', sans-serif; }
.eyebrow, .step-label { color: var(--teal); font-size: 10px; font-weight: 700; letter-spacing: .13em; }
.brand-name { font: 800 17px 'Manrope', sans-serif; letter-spacing: -.04em; }
.brand-name span { font-weight: 500; color: #75858b; }
.topbar-meta { color: var(--muted); font-size: 12px; }
.live-dot, .status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #49a67e; vertical-align: 1px; }
.hero { display: flex; justify-content: space-between; align-items: end; padding: 46px 0 36px; }
.hero h1 { margin: 12px 0 14px; font: 800 clamp(34px, 4.2vw, 49px)/1.08 'Manrope', sans-serif; letter-spacing: -.055em; }
.hero h1 em { color: var(--teal); font-style: normal; }
.hero-subtitle { max-width: 600px; margin: 0; color: var(--ink-soft); font-size: 15px; line-height: 1.7; }
.hero-stat { min-width: 155px; padding: 0 0 4px 25px; border-left: 1px solid #d5dfdd; }
.stat-number { font: 800 43px/1 'Manrope', sans-serif; letter-spacing: -.06em; }
.stat-label { margin-top: 5px; color: var(--muted); font-size: 12px; }
.stat-rule { width: 30px; height: 2px; margin: 16px 0 9px; background: var(--gold); }
.stat-foot { color: var(--muted); font-size: 11px; }
.setup-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 18px; align-items: stretch; }
.right-column { display: flex; flex-direction: column; gap: 18px; }
.panel { background: var(--white); border: 1px solid #e6eceb; border-radius: 15px; box-shadow: var(--shadow); padding: 25px 26px; }
.panel-heading, .history-header, .result-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.step-label { display: flex; align-items: center; gap: 8px; }
.step-label > span:first-child { display: inline-grid; place-items: center; width: 19px; height: 19px; border-radius: 6px; background: var(--teal-pale); color: var(--teal); font-size: 9px; letter-spacing: 0; }
h2 { margin: 9px 0 8px; font: 800 22px 'Manrope', sans-serif; letter-spacing: -.045em; }
.panel-intro { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.count-pill { padding: 7px 10px; background: #edf3f2; color: var(--teal-dark); border-radius: 100px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.source-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 21px 0 15px; background: #f1f5f4; border-radius: 9px; }
.source-btn { border: 0; background: transparent; color: var(--muted); padding: 9px 10px; border-radius: 7px; font-size: 11px; font-weight: 700; }
.source-btn.active { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(20,43,59,.08); }
.toolbar-row, .history-source-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.team-month-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; margin: 0 0 14px; }
.team-month-buttons { display: flex; gap: 7px; align-items: center; }
.refresh-month-button, 
.team-month-controls .format-field select { height: 38px; }

.suggestions-note { width: 100%; color: #98a5a9; font-size: 10px; line-height: 1.5; padding: 6px 0; }
.source-status, .history-status { color: var(--muted); font-size: 11px; }
.source-status .status-dot, .history-status .status-dot { width: 6px; height: 6px; }
.source-status.error .status-dot, .history-status.error .status-dot { background: #d26d62; }
.text-button { padding: 4px 0; border: 0; background: none; color: var(--teal); font-size: 11px; font-weight: 700; }
.text-button:hover, .small-button:hover { text-decoration: underline; }
.field-label { display: flex; justify-content: space-between; color: var(--ink-soft); font-size: 11px; font-weight: 700; margin-bottom: 7px; }
.field-label span { color: #98a5a9; font-weight: 500; }
.team-textarea { display: block; width: 100%; min-height: 296px; resize: vertical; border: 1px solid #dfe7e6; border-radius: 9px; padding: 13px 14px; color: var(--ink); background: #fbfdfc; outline: none; font: 500 12px/1.75 'DM Sans', sans-serif; transition: border .15s, box-shadow .15s; }
.team-textarea:focus, select:focus, input:focus { border-color: #69aaa7; box-shadow: 0 0 0 3px rgba(8,126,131,.10); outline: 0; }
.field-foot { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-top: 9px; color: #98a5a9; font-size: 10px; line-height: 1.5; }
.small-button { flex-shrink: 0; border: 0; padding: 0; background: transparent; color: var(--teal); font-size: 10px; font-weight: 700; }
.optional-tag { margin-left: 3px; padding: 4px 6px; border-radius: 4px; background: #f2f4f3; color: #8a989a; font-size: 8px; letter-spacing: .08em; }
.format-panel { flex: 0 0 auto; }
.format-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-top: 18px; }
.format-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; color: #859398; font-size: 10px; font-weight: 700; }
.format-field select { width: 100%; height: 38px; padding: 0 10px; border: 1px solid #e0e7e6; border-radius: 7px; background: #f9fbfa; color: var(--ink); font-size: 12px; font-weight: 700; appearance: none; }
.format-note { display: flex; align-items: flex-start; gap: 9px; margin-top: 15px; padding: 11px 12px; border-radius: 8px; background: #f6f8f7; color: var(--muted); font-size: 10px; line-height: 1.55; }
.info-icon { display: inline-grid; place-items: center; flex: 0 0 15px; width: 15px; height: 15px; border-radius: 50%; background: #e1edeb; color: var(--teal); font: 700 10px serif; }
.included-panel { flex: 1; }
.pair-picker { display: grid; grid-template-columns: 1fr 17px 1fr 34px; gap: 7px; align-items: end; margin-top: 17px; }
.pair-picker .format-field select { height: 36px; font-size: 10px; }
.pair-dash { display: grid; place-items: center; height: 36px; color: #9aabad; font-size: 14px; }
.add-pair-btn { height: 36px; border: 0; border-radius: 7px; background: var(--teal); color: white; font-size: 20px; line-height: 1; }
.add-pair-btn:hover { background: var(--teal-dark); }
.suggested-pairs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.suggested-pair { border: 1px solid #e1e8e7; border-radius: 6px; background: #fff; color: #69797f; padding: 5px 7px; font-size: 9px; }
.suggested-pair:hover { border-color: #9bc5c1; color: var(--teal-dark); }
.suggested-pair.added { background: var(--teal-pale); border-color: #b9d9d5; color: var(--teal-dark); }
.included-list { display: flex; flex-direction: column; gap: 7px; margin-top: 13px; max-height: 130px; overflow: auto; }
.included-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-radius: 7px; padding: 8px 10px; background: #f6f9f8; color: var(--ink-soft); font-size: 10px; }
.included-item strong { font-weight: 700; }
.remove-pair { border: 0; background: transparent; color: #9aabad; padding: 0 3px; font-size: 16px; }
.remove-pair:hover { color: var(--red); }
.empty-state { padding: 12px 5px; color: #a3afb1; font-size: 10px; }
.history-panel { margin-top: 18px; }
.history-header { align-items: center; }
.history-header > div:first-child { max-width: 670px; }
.switch-wrap { display: flex; align-items: center; gap: 10px; white-space: nowrap; color: var(--ink-soft); font-size: 11px; font-weight: 700; cursor: pointer; }
.switch-wrap input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { width: 37px; height: 21px; border-radius: 20px; background: #d9e1df; position: relative; transition: background .18s; }
.switch::after { content: ''; position: absolute; width: 15px; height: 15px; left: 3px; top: 3px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(0,0,0,.15); transition: transform .18s; }
.switch-wrap input:checked + .switch { background: var(--teal); }
.switch-wrap input:checked + .switch::after { transform: translateX(16px); }
.history-controls { margin-top: 19px; padding-top: 15px; border-top: 1px solid #edf1f0; }
.history-controls.is-disabled { opacity: .55; }
.history-target-grid { display: grid; grid-template-columns: 1.2fr 1fr 1.35fr; gap: 14px; align-items: stretch; }
.history-target { display: flex; flex-direction: column; gap: 8px; color: #849297; font-size: 10px; font-weight: 700; }
.number-input-wrap { display: flex; align-items: center; gap: 9px; }
.number-input-wrap input { width: 72px; height: 37px; border: 1px solid #e0e7e6; border-radius: 7px; background: #fbfdfc; padding: 0 10px; color: var(--ink); font-size: 14px; font-weight: 700; }
.number-input-wrap small { color: #9aa6a8; font-size: 10px; font-weight: 500; }
.range-input-wrap { gap: 10px; }
.range-field { display: inline-flex; align-items: center; gap: 5px; }
.range-field small { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.range-field input { width: 58px; }
.auto-fill-option { display: flex; align-items: flex-start; gap: 9px; padding: 11px 12px; border-radius: 8px; background: #f5f8f7; color: var(--ink-soft); font-size: 10px; }
.auto-fill-option input { margin: 2px 0 0; accent-color: var(--teal); }
.auto-fill-option span { display: flex; flex-direction: column; gap: 4px; }
.auto-fill-option strong { font-size: 10px; }
.auto-fill-option small { color: #8c999d; line-height: 1.5; font-size: 9px; font-weight: 400; }
.history-help { margin-top: 12px; color: #9aa6a8; font-size: 10px; line-height: 1.5; }
.generate-section { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 29px 0 25px; }
.generate-copy { max-width: 610px; }
.generate-copy h2 { margin-bottom: 5px; }
.generate-copy p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.generate-action { min-width: 230px; }
.generate-btn { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 14px 16px 14px 19px; border: 0; border-radius: 8px; background: var(--ink); color: white; font: 700 12px 'DM Sans', sans-serif; box-shadow: 0 5px 15px rgba(20,43,59,.15); }
.generate-btn:hover { background: #1d4257; transform: translateY(-1px); }
.generate-btn:disabled { opacity: .7; transform: none; }
.generate-btn b { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: rgba(255,255,255,.12); font-size: 16px; }
.generate-caption { margin-top: 7px; text-align: center; color: #a0acad; font-size: 9px; }
.alert-box { margin: 0 0 20px; padding: 13px 15px; border: 1px solid #f0c8c2; border-radius: 9px; background: var(--red-pale); color: #8f443e; font-size: 11px; line-height: 1.6; }
.alert-box.success { border-color: #c2ded5; background: #eef8f4; color: #256e57; }
.alert-box.info { border-color: #c9dfde; background: #f0f7f6; color: #286d70; }
.result-section { padding: 28px 25px; border: 1px solid #e4eae9; border-radius: 15px; background: #fff; box-shadow: var(--shadow); }
.result-heading { align-items: center; }
.result-heading h2 { font-size: 25px; }
.result-actions { display: flex; gap: 8px; }
.outline-button { padding: 9px 12px; border: 1px solid #dce5e3; border-radius: 7px; background: #fff; color: var(--ink-soft); font-size: 10px; font-weight: 700; }
.outline-button:hover { border-color: #8dbbb6; color: var(--teal-dark); }
.validation-summary { display: flex; flex-wrap: wrap; gap: 7px; margin: 19px 0 15px; }
.validation-item { display: inline-flex; align-items: center; gap: 6px; padding: 7px 9px; border-radius: 6px; background: #edf7f3; color: #3c7866; font-size: 9px; font-weight: 700; }
.validation-item::before { content: '✓'; font-size: 11px; }
.matrix-wrap, .team-summary-wrap { width: 100%; overflow-x: auto; }
.matrix-table { width: 100%; min-width: 720px; border-collapse: separate; border-spacing: 6px; table-layout: fixed; }
.matrix-table td { vertical-align: top; padding: 10px 10px; height: 72px; border: 1px solid #e3eae8; border-radius: 7px; background: #fbfdfc; }
.matrix-table td.blank-site { background: #f4f6f5; border-style: dashed; }
.site-label { margin-bottom: 6px; color: #9ba8aa; font-size: 8px; font-weight: 700; letter-spacing: .06em; }
.site-teams { color: var(--ink); font-size: 10px; font-weight: 700; line-height: 1.5; }
.site-teams span { display: block; }
.appearance-section { margin-top: 27px; padding-top: 22px; border-top: 1px solid #edf1f0; }
.appearance-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.appearance-heading h3 { margin: 0 0 4px; font: 800 16px 'Manrope', sans-serif; letter-spacing: -.03em; }
.appearance-heading p { margin: 0; color: var(--muted); font-size: 10px; }
.appearance-legend { display: flex; gap: 5px; flex-wrap: wrap; }
.legend-chip { padding: 4px 6px; border-radius: 4px; font-size: 8px; font-weight: 700; }
.legend-chip.oct { background: #f9edda; color: #94671f; }
.legend-chip.nov { background: #e6f0fa; color: #416e9c; }
.legend-chip.included { background: #e5f3ee; color: #32765e; }
.team-summary-table { width: 100%; min-width: 740px; border-collapse: collapse; }
.team-summary-table th { text-align: left; padding: 9px 10px; background: #f5f8f7; color: #8d9a9d; font-size: 9px; font-weight: 700; }
.team-summary-table td { padding: 9px 10px; border-bottom: 1px solid #edf1f0; color: var(--ink-soft); font-size: 10px; }
.team-summary-table td:first-child { color: var(--ink); font-weight: 700; }
.team-summary-table .muted-cell { color: #9ba7a8; }
.team-summary-table .count-cell { font-variant-numeric: tabular-nums; font-weight: 700; }
.footer { display: flex; justify-content: space-between; padding: 26px 0 0; color: #9ba7a8; font-size: 9px; letter-spacing: .06em; }
.footer span:first-child { color: #73858a; font-weight: 700; }
@media (max-width: 900px) {
  .setup-grid { grid-template-columns: 1fr; }
  .right-column { display: grid; grid-template-columns: 1fr 1fr; }
  .panel { padding: 22px; }
  .team-textarea { min-height: 260px; }
  .team-month-controls { grid-template-columns: 1fr; }
  .team-month-buttons { display: grid; grid-template-columns: 1fr 1fr; }
  .history-target-grid { grid-template-columns: 1fr 1fr; }
  .auto-fill-option { grid-column: span 2; }
}
@media (max-width: 640px) {
  .page-shell { padding: 0 16px 30px; }
  .topbar { padding: 18px 0; }
  .topbar-meta { max-width: 115px; text-align: right; line-height: 1.4; }
  .hero { padding: 35px 0 26px; align-items: flex-start; }
  .hero h1 { font-size: 35px; }
  .hero-subtitle { max-width: 94%; font-size: 13px; }
  .hero-stat { display: none; }
  .right-column { display: flex; }
  .panel { padding: 20px 18px; }
  .history-header { flex-direction: column; }
  .switch-wrap { align-self: flex-start; }
  .history-target-grid { grid-template-columns: 1fr 1fr; }
  .auto-fill-option { grid-column: span 2; }
  .generate-section { align-items: stretch; flex-direction: column; }
  .generate-action { width: 100%; }
  .result-section { padding: 21px 15px; }
  .result-heading { flex-direction: column; align-items: stretch; }
  .result-actions { flex-wrap: wrap; }
  .appearance-heading { align-items: flex-start; flex-direction: column; }
  .footer { gap: 12px; flex-direction: column; }
}
@media print {
  body { background: #fff; }
  .topbar, .hero, .setup-grid, .history-panel, .generate-section, .alert-box, .footer, .result-actions { display: none !important; }
  .page-shell { max-width: none; padding: 0; }
  .result-section { display: block !important; padding: 0; border: 0; box-shadow: none; }
  .matrix-table { min-width: 0; border-spacing: 3px; }
  .matrix-table td { height: 60px; padding: 5px; }
  .site-teams { font-size: 8px; }
  .team-summary-table td, .team-summary-table th { font-size: 8px; padding: 5px; }
}
.count-pill.invalid { background: #fff0ee; color: var(--red); }
.opp-chip { display: inline-block; margin: 1px 2px 2px 0; padding: 3px 5px; border-radius: 4px; background: #f0f3f2; color: #67787e; font-size: 8px; white-space: nowrap; }
.opp-chip.oct { background: #f9edda; color: #94671f; }
.opp-chip.nov { background: #e6f0fa; color: #416e9c; }
.opp-chip.included { background: #e5f3ee; color: #32765e; }
.opponent-list { max-width: 570px; line-height: 1.8; }

.schedule-choices { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin: 0 0 16px; }
.schedule-choices[hidden] { display: none; }
.schedule-choices-label { margin-right: 4px; color: var(--muted); font-size: 10px; font-weight: 700; }
.schedule-choice { padding: 7px 11px; border: 1px solid #dce5e3; border-radius: 7px; background: #fff; color: var(--ink-soft); font-size: 10px; font-weight: 700; }
.schedule-choice:hover { border-color: #8dbbb6; color: var(--teal-dark); }
.schedule-choice.active { border-color: var(--teal); background: var(--teal-pale); color: var(--teal-dark); box-shadow: inset 0 0 0 1px var(--teal); }
