#view-planner { overflow-y: auto; }
#planner-root { color: var(--c-text-primary); padding: 14px 18px 25px; width: 100%; box-sizing: border-box; }
#planner-root * { box-sizing: border-box; }
.op-hero, .op-workspace { max-width: 680px; margin: 0 auto; }
.op-hero { text-align: center; }
.op-hero h1 { font-size: 23px; letter-spacing: -.5px; margin: 0 0 12px; font-weight: 800; }
.op-panel { background: var(--c-surface); border: 1px solid var(--c-border-soft); border-radius: 8px; box-shadow: var(--shadow-sm); }
.op-controls { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; margin-bottom: 12px; }
.op-primary-filters { display: grid; grid-template-columns: minmax(130px, 180px) repeat(2, minmax(105px, 155px)); justify-content: center; gap: 10px; }
.op-filter, .op-finish { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 10px; font-weight: 600; color: var(--c-text-subtle); }
.op-filter select, .op-finish select { width: 100%; height: 30px; border-radius: 5px; border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-text-primary); font: inherit; font-size: 11px; padding: 0 7px; }
.op-filter select { text-align: center; text-align-last: center; }
.op-filter > label { text-align: center; }
.op-filter select:focus-visible, .op-finish select:focus-visible { outline: 2px solid var(--c-focus-ring); outline-offset: 2px; }
.op-filter option { text-align: center; }
.op-week-filter { position: relative; }
#planner-root .op-week-filter .select2-container { width: 100% !important; }
#planner-root .op-week-filter > .select2-container--open:not(.select2) { width: 100% !important; left: auto !important; right: 0; z-index: 100; }
#planner-root .op-week-filter .select2-selection--single { height: 30px; padding: 0; border-radius: 10px; border: 1px solid var(--c-border); background: var(--c-surface); }
#planner-root .op-week-filter .select2-selection__rendered { padding: 0 16px 0 4px; line-height: 28px; font-size: 11px; font-weight: 600; text-align: center; color: var(--c-text-primary); }
#planner-root .op-week-filter .select2-selection__arrow { height: 28px; width: 16px; }
#planner-root .op-week-filter .select2-selection:focus-visible { outline: 2px solid var(--c-focus-ring); outline-offset: 2px; }
#planner-root .op-week-menu { width: 100% !important; min-width: 0 !important; border: 1px solid var(--c-border-strong); background: var(--c-surface); }
#planner-root .op-week-menu .select2-results__options { max-height: min(320px, 50vh); }
#planner-root .op-week-menu .select2-results__option { padding: 4px; font-size: 11px; text-align: center; }
.op-ending-slam-option { display: flex; flex-direction: column; gap: 3px; border: 2px solid currentColor; border-radius: 5px; padding: 4px; line-height: 1.3; }
.op-ending-slam-title { font-size: 11px; font-weight: 400; }
.op-results { min-width: 0; }
.op-body { display: contents; }
.op-planner { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; min-width: 0; }
.op-week-list { display: flex; flex-direction: column; gap: 8px; }
.op-week { overflow: hidden; }
.op-week-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; margin: 0; padding: 7px 10px; background: var(--c-chrome-bg); color: white; font-size: 11px; font-weight: 800; }
.op-week-meta { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-end; gap: 3px 10px; margin-left: auto; max-width: 100%; text-align: right; }
.op-week-note { font-size: 9px; font-weight: 400; line-height: 1.4; }
.op-week-note strong { color: #c00000; background: white; border-radius: 2px; padding: 0 3px; font-size: 11px; font-weight: 900; }
.op-calendar-row { display: grid; grid-template-columns: 85px minmax(0, 1fr); }
.op-calendar-row.op-calendar-selected { grid-template-columns: minmax(0, 1fr); }
.op-calendar-rest .op-calendar-events { grid-column: 2; }
.op-calendar-row + .op-calendar-row { border-top: 1px solid var(--c-border); }
.op-calendar-region { margin: 0; padding: 7px 5px; display: flex; align-items: center; justify-content: center; background: var(--c-surface-alt); color: var(--c-text-subtle); border-right: 1px solid var(--c-border); text-align: center; font-size: 9px; line-height: 1.4; }
.op-calendar-events { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: center; gap: 6px; padding: 6px; }
.op-calendar-item { flex: 0 1 auto; min-width: 0; max-width: 100%; }
.op-calendar-item.op-choice { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; flex: 1 1 100%; gap: 5px; }
.op-inline-controls { display: flex; align-items: center; flex: 0 0 auto; gap: 4px; max-width: 100%; }
.op-inline-controls .op-finish { flex: 0 0 86px; width: 86px; max-width: 86px; }
.op-inline-controls .op-route-note { display: none; }
.op-entry-unavailable { position: relative; }
.op-entry-unavailable::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(to top right, transparent calc(50% - 1px), #c00000 calc(50% - 1px), #c00000 calc(50% + 1px), transparent calc(50% + 1px)); }
.op-week-replaced { font-size: 9px; font-weight: 400; line-height: 1.4; }
.op-entry-preview { overflow: auto; max-width: 100%; max-height: 460px; padding: 8px; border-top: 1px solid var(--c-border-soft); }
.op-entry-table { min-width: 300px; }
#planner-root .calendar-tournament { width: auto; max-width: 100%; display: flex; align-items: center; gap: 5px; margin: 0; padding: 4px 6px; border: 0; font-family: inherit; font-size: 10px; text-align: left; white-space: normal; line-height: 1.4; cursor: pointer; }
#planner-root .calendar-tournament > span:first-child { overflow-wrap: anywhere; }
#planner-root .calendar-tournament.cal-rest { background: #d1d5db; color: #242b35; font-weight: 700; }
[data-theme="dark"] #planner-root .calendar-tournament.cal-rest { background: #4b5563; color: #f3f4f6; }
#planner-root .calendar-tournament:disabled { opacity: .4; cursor: not-allowed; }
#planner-root .calendar-tournament:focus-visible { outline: 3px solid var(--c-focus-ring); outline-offset: 2px; }
#planner-root .calendar-tournament.op-event-active,
#planner-root .calendar-tournament.op-event-selected { font-weight: 700; box-shadow: 0 0 0 2px #123e70; }
.op-delay-badge { flex: 0 0 auto; font-size: 13px; line-height: 1; font-weight: 900; padding: 1px 4px; border-radius: 3px; background: #fff; color: #c00000; }
.op-compare-table small { display: block; font-size: 9px; font-weight: 400; color: var(--c-text-subtle); line-height: 1.5; margin-top: 3px; }
.op-finish { flex: 1; font-size: 9px; }
.op-finish select { font-size: 9px; padding: 0 2px; text-align: center; text-align-last: center; font-weight: 700; }
.op-finish option { font-weight: 700; text-align: center; }
.op-route-note { flex: 1; font-size: 9px; color: var(--c-text-subtle); }
.op-gain { color: var(--c-success-strong) !important; }
[data-theme="dark"] .op-gain { color: #6ee7b7 !important; }
#planner-root .btn { min-height: 28px; height: auto; font-size: 10px; padding: 5px 8px; }
#planner-root .op-inline-controls .btn { padding: 4px; font-size: 9px; white-space: nowrap; }
.op-card-note, .op-small-note { margin: 7px 0; font-size: 9px; color: var(--c-text-subtle); line-height: 1.5; }
.op-notice { background: var(--c-primary-softer); padding: 8px 10px; border-radius: 5px; font-size: 10px; color: var(--c-text-secondary); margin: 0 0 10px; }
.op-comparison, .op-summary { padding: 12px; }
.op-summary { width: 100%; padding: 10px; }
.op-summary-actions { margin-top: 8px; }
.op-summary-actions .btn { width: 100%; text-align: center; }
.op-calendar-clear { display: none; }
.op-clear-short { display: none; }
.op-comparison > summary { font-size: 12px; font-weight: 800; cursor: pointer; margin-bottom: 8px; }
.op-section-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.op-section-head h2 { font-size: 13px; margin: 0; }
.op-table-scroll { overflow-x: auto; }
.op-compare-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 10px; }
.op-compare-table th, .op-compare-table td { border-bottom: 1px solid var(--c-border-soft); padding: 6px; min-width: 115px; vertical-align: top; line-height: 1.5; }
.op-compare-table th:first-child { min-width: 85px; width: 85px; font-size: 9px; font-weight: 600; }
#planner-root .op-compare-table thead th { background: var(--c-chrome-bg) !important; color: white; font-size: 10px; }
#planner-root .op-compare-table tbody th { background: var(--c-surface) !important; color: var(--c-text-subtle); position: static; text-transform: none; text-align: left; }
#planner-root .op-compare-table thead .op-remove { color: white; }
#planner-root .btn-secondary { background: var(--c-surface); color: var(--c-text-primary); border-color: var(--c-border-strong); }
#planner-root .btn-secondary:hover:not(:disabled) { background: var(--c-surface-alt); }
.op-compare-table .op-finish > span { display: none; }
.op-remove { border: 0; color: var(--c-text-muted); background: transparent; font: inherit; font-size: 20px; padding: 0 4px; cursor: pointer; line-height: 1; border-radius: 4px; }
.op-compare-table .op-remove { float: right; margin-left: 4px; }
.op-summary .op-small-note, .op-summary .op-card-note { font-size: 8px; margin: 5px 0; }
.op-schedule-summary { display: flex; align-items: center; justify-content: space-around; background: var(--c-primary-softer); border-radius: 5px; margin-top: 8px; padding: 8px 6px; gap: 6px; }
.op-schedule-summary > div { flex: 1; font-size: 9px; color: var(--c-text-subtle); text-align: center; }
.op-schedule-summary strong { display: block; font-size: 18px; color: var(--c-text-primary); margin-top: 4px; font-weight: 800; }
.op-schedule-summary > span { color: var(--c-text-muted); font-size: 16px; }
.op-warning { padding: 9px; border: 1px solid #d5a341; border-radius: 5px; font-size: 10px; line-height: 1.5; }
.op-warning ul { margin: 6px 0 0; padding-left: 15px; }
.op-empty { text-align: center; padding: 24px 12px; font-size: 12px; }
.op-breakdown { margin-top: 12px; min-width: 0; }
.op-breakdown h2 { margin: 0; font-size: 12px; }
#op-breakdown-toggle, .op-breakdown-heading { box-sizing: border-box; position: relative; width: 100%; padding: 10px 30px; border: 0; border-radius: 7px 7px 0 0; background: #262626; color: #fff; font: inherit; font-weight: 800; text-align: center; }
#op-breakdown-toggle { display: block; cursor: pointer; }
.op-breakdown-heading { display: none; }
#op-breakdown-toggle[aria-expanded="false"] { border-radius: 7px; }
#op-breakdown-toggle:focus-visible { outline: 3px solid var(--c-focus-ring); outline-offset: -3px; }
#op-breakdown-toggle .calendar-toggle-arrow { position: absolute; right: 14px; top: 50%; margin: -4px 0 0; }
#op-breakdown-toggle[aria-expanded="true"] .calendar-toggle-arrow { margin-top: 0; transform: rotate(225deg); }
.op-breakdown .table-wrapper { border-radius: 0; }
#op-breakdown-table { width: 100%; min-width: 0; border-radius: 0 0 7px 7px; }
#op-breakdown-table td:nth-child(2) { white-space: normal; overflow-wrap: anywhere; }
.op-result-replaced, .op-result-new { display: inline-block; padding: 1px 4px; border-radius: 3px; color: #fff; font-weight: 700; line-height: 1.3; white-space: nowrap; }
.op-result-replaced { background: #b91c1c; }
.op-result-new { background: #166534; }
@media (min-width: 769px) {
    #op-breakdown-toggle { display: none; }
    .op-breakdown-heading { display: block; }
    #view-planner { width: 100%; max-width: none; }
    .op-workspace { max-width: none; }
    .op-toolbar, .op-body { display: grid; grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr); column-gap: 16px; }
    .op-toolbar { align-items: stretch; margin-bottom: 12px; }
    .op-body { align-items: start; }
    .op-body .op-results { grid-column: 1; margin: 0; }
    .op-body .op-breakdown { grid-column: 3; margin-top: 0; }
    #op-breakdown-table col.rtgs-col-date, #op-breakdown-table col.rtgs-col-drop-date { width: 16%; }
    #op-breakdown-table col.rtgs-col-round { width: 13%; }
    #op-breakdown-table col.rtgs-col-points { width: 8%; }
    #op-breakdown-table th, #op-breakdown-table td { padding: 5px 6px; font-size: 10px; }
    .op-toolbar .op-controls, .op-toolbar .op-planner { min-width: 0; margin-bottom: 0; }
    .op-primary-filters { grid-template-columns: minmax(0, 1.3fr) repeat(2, minmax(0, 1fr)); gap: 8px; }
    .op-summary { display: flex; flex-direction: column; justify-content: center; flex: 1; }
    .op-summary .op-schedule-summary { margin-top: 0; padding-top: 4px; padding-bottom: 4px; }
    .op-summary-actions { display: none; }
    .op-calendar-clear { display: block; align-self: center; }
    #planner-root .op-calendar-clear .btn { width: 64px; height: 64px; padding: 6px; border-radius: 4px; white-space: normal; text-align: center; }
    .op-finish select, #planner-root .op-inline-controls .btn { font-size: 10px; }
    .op-week-replaced { font-size: 11px; }
}
@media (min-width: 769px) and (max-width: 1099px) {
    .op-primary-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .op-filter:first-child { grid-column: 1 / -1; }
    #op-breakdown-table th, #op-breakdown-table td { padding: 3px; font-size: 8px; }
}
@media (max-width: 768px) {
    #op-breakdown-toggle { padding-top: 6px; padding-bottom: 6px; }
    .op-breakdown[data-expanded="false"] #op-breakdown-content { display: none; }
    .op-hero { display: none; }
    .op-workspace { display: flex; flex-direction: column; }
    .op-toolbar { display: contents; }
    .op-controls { order: 0; margin-bottom: 6px; }
    .op-notice { order: 1; }
    .op-results { order: 2; }
    .op-breakdown { order: 4; }
    .op-calendar-row { grid-template-columns: 38px minmax(0, 1fr); }
    .op-planner { order: 3; gap: 6px; margin-top: 6px; margin-bottom: 0; }
    .op-summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 6px; padding: 6px; }
    .op-summary .op-schedule-summary { grid-area: 1 / 1; min-width: 0; margin: 0; padding: 4px; gap: 4px; }
    .op-summary-actions { grid-area: 1 / 2; margin: 0; }
    .op-summary .op-card-note, .op-summary .op-small-note { grid-column: 1 / -1; margin: 0; }
    .op-clear-full { display: none; }
    .op-clear-short { display: inline; }
    .op-schedule-summary > div { font-size: 8px; }
    .op-schedule-summary strong { font-size: 12px; margin-top: 2px; }
    .op-schedule-summary > span { font-size: 10px; }
    .op-summary .op-small-note, .op-summary .op-card-note { font-size: 7px; }
    #planner-root .op-summary .btn { font-size: 9px; }
    .op-summary .op-warning { font-size: 9px; }
    .op-week-list { gap: 6px; }
    .op-week-heading { padding: 5px 8px; }
}
@media (max-width: 650px) {
    #planner-root { padding: 6px 8px 12px; }
    .op-controls { padding: 6px 8px; gap: 5px; }
    .op-primary-filters { grid-template-columns: 1fr .85fr 1.15fr; gap: 5px; }
    .op-filter { font-size: 9px; gap: 2px; }
    .op-filter select { font-size: 10px; height: 28px; padding: 0 3px; }
    #planner-root .op-week-filter .select2-selection--single { height: 28px; }
    #planner-root .op-week-filter .select2-selection__rendered { font-size: 10px; line-height: 26px; }
    #planner-root .op-week-filter .select2-selection__arrow { height: 26px; }
    .op-calendar-region { font-size: 8px; padding: 5px 4px; }
    .op-calendar-events { gap: 5px; padding: 4px; }
    .op-calendar-selected .op-choice { flex-wrap: nowrap; }
    #planner-root .op-calendar-selected .op-tournament { flex: 0 1 auto; min-width: 0; }
    #planner-root .calendar-tournament { font-size: 9px; padding: 4px 5px; }
}
