:root {
    color-scheme: dark;
    --bg: #101418;
    --bg-soft: #121a21;
    --panel: #181f26;
    --text: #f7f9fb;
    --muted: #aab4bf;
    --accent: #30c48d;
    --danger: #ff6b6b;
    --warning: #f7c948;
    --border: #2a333d;
    --font-ui: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --pm-brand-wordmark-width: 220px;
    --control-bg: #0f151b;
    --control-height: 46px;
    --control-radius: 6px;
    --control-padding-x: 12px;
    --control-padding-y: 10px;
    --form-gap: 16px;
    --field-gap: 7px;
    --space-internal: 12px;
    --space-component: 20px;
    --space-section: 34px;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-ui);
    background:
        radial-gradient(circle at 15% 0%, rgba(48, 196, 141, 0.08), transparent 28rem),
        linear-gradient(135deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 12px),
        var(--bg);
    color: var(--text);
}

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

.tagline {
    margin: 0 0 10px;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
}

form {
    display: grid;
    gap: var(--form-gap);
}

label {
    display: grid;
    gap: var(--field-gap);
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.35;
    min-width: 0;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
select {
    border: 1px solid var(--border);
    border-radius: var(--control-radius);
    background: var(--control-bg);
    color: var(--text);
    font: inherit;
    height: var(--control-height);
    line-height: 1.25;
    max-inline-size: 100%;
    max-width: 100%;
    min-inline-size: 0;
    min-width: 0;
    padding: var(--control-padding-y) var(--control-padding-x);
    width: 100%;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: #07100d;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    min-height: var(--control-height);
    padding: 12px 16px;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, filter 160ms ease, transform 160ms ease;
}

button:hover,
.button:hover {
    filter: brightness(1.07);
    transform: translateY(-1px);
}

button:focus-visible,
.button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--control-focus-outline, rgba(48, 196, 141, 0.55));
    outline-offset: 3px;
}

.panel {
    width: min(100%, 420px);
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    padding: 28px;
}

textarea {
    border: 1px solid var(--border);
    border-radius: var(--control-radius);
    background: var(--control-bg);
    color: var(--text);
    font: inherit;
    line-height: 1.45;
    max-inline-size: 100%;
    max-width: 100%;
    min-height: calc(var(--control-height) * 2);
    min-inline-size: 0;
    min-width: 0;
    padding: var(--control-padding-y) var(--control-padding-x);
    width: 100%;
}

input[type="date"] {
    box-sizing: border-box;
    display: block;
    inline-size: 100%;
    max-inline-size: 100%;
    max-width: 100%;
    min-inline-size: 0;
    min-width: 0;
    width: 100%;
}

input[type="file"] {
    border: 1px solid var(--border);
    border-radius: var(--control-radius);
    background: var(--control-bg);
    color: var(--text);
    cursor: pointer;
    font: inherit;
    line-height: 1.25;
    max-width: 100%;
    min-height: var(--control-height);
    min-width: 0;
    padding: 8px;
    width: 100%;
}

input[type="file"]::file-selector-button {
    border: 0;
    border-radius: 5px;
    background: #27313b;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    margin-right: 10px;
    min-height: 30px;
    padding: 6px 10px;
}

input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--accent);
    flex: 0 0 auto;
    height: 1rem;
    margin: 0;
    padding: 0;
    width: 1rem;
}

input[type="date"]::-webkit-date-and-time-value {
    display: block;
    min-width: 0;
    text-align: left;
    width: 100%;
}

textarea {
    resize: vertical;
}

button.secondary,
.button.secondary {
    background: #27313b;
    color: var(--text);
}

button.danger,
.button.danger {
    background: #47232a;
    color: #ffd7dc;
}

.error {
    color: var(--danger);
}

.autocomplete-field {
    display: block;
    max-width: 100%;
    min-width: 0;
    position: relative;
    width: 100%;
}

.autocomplete-results {
    background: #10171e;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
    box-sizing: border-box;
    display: grid;
    gap: 4px;
    left: 0;
    max-height: 320px;
    max-width: 100%;
    min-width: 0;
    overflow-y: auto;
    padding: 6px;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    width: 100%;
    z-index: 80;
}

.autocomplete-results[hidden] {
    display: none;
}

.autocomplete-option {
    align-items: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text);
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr);
    justify-content: start;
    min-height: 46px;
    padding: 8px;
    text-align: left;
    width: 100%;
}

.autocomplete-option.has-badge {
    grid-template-columns: auto minmax(0, 1fr);
}

.autocomplete-option:hover,
.autocomplete-option:focus-visible,
.autocomplete-option.is-active {
    background: #1a242d;
    border-color: color-mix(in srgb, var(--accent) 26%, var(--border));
    filter: none;
    transform: none;
}

.autocomplete-option img {
    border: 1px solid var(--border);
    border-radius: 5px;
    height: 32px;
    object-fit: contain;
    padding: 3px;
    width: 32px;
}

.autocomplete-option span {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.autocomplete-option strong {
    color: var(--text);
    font-size: 0.92rem;
    overflow-wrap: anywhere;
}

.autocomplete-option small {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

/* Shared Club/Team creation panel used by Add Match and Football Settings. */
.pm-team-create {
    background: rgba(7, 17, 26, 0.36);
    border: 1px solid var(--pm-border);
    border-radius: 7px;
    column-gap: 16px;
    display: grid;
    margin-top: 2px;
    min-width: 0;
    padding: 14px;
    row-gap: 20px;
}

.pm-team-create[hidden] { display: none !important; }
.pm-team-create__heading {
    align-items: center;
    display: flex;
    grid-column: 1 / -1;
    justify-content: space-between;
    min-width: 0;
}
.pm-team-create__heading strong { color: var(--pm-text-primary); font-size: var(--pm-type-label); }
.pm-team-create__heading button {
    background: transparent !important;
    border: 0 !important;
    color: var(--pm-text-muted) !important;
    min-height: 44px;
    padding: 6px 2px;
}
.pm-team-create__heading button:hover,
.pm-team-create__heading button:focus-visible { color: var(--pm-green-highlight) !important; }
.pm-team-create > label,
.pm-team-create__fields > label { align-content: start; }
.pm-team-create__fields {
    border: 0;
    display: grid;
    gap: 20px 16px;
    grid-column: 1 / -1;
    margin: 0;
    min-width: 0;
    padding: 0;
}
.pm-team-create .pm-team-create__fields > label {
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 400;
    gap: var(--field-gap);
}
.pm-team-create__club { display: grid; gap: 5px; margin: 0; min-width: 0; }
.pm-team-create__club span { color: var(--muted); font-size: 0.95rem; }
.pm-team-create__club strong { color: var(--text); overflow-wrap: anywhere; }
.pm-team-create__explanation { margin: 0; }

@media (min-width: 768px) {
    .pm-team-create,
    .pm-team-create__fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pm-team-create > label,
    .pm-team-create__fields > label { grid-template-rows: auto 48px; }
    .pm-team-create__club { grid-column: 1; grid-row: 1; }
    .pm-team-create__type { grid-column: 2; grid-row: 1; }
    .pm-team-create__explanation { grid-column: 1; grid-row: 2; }
    .pm-team-create__name { grid-column: 2; grid-row: 2; }
    .pm-team-create__age { grid-column: 2; grid-row: 3; }
}

@media (max-width: 767px) {
    .pm-team-create,
    .pm-team-create__fields { row-gap: 22px; }
    .pm-team-create > label,
    .pm-team-create .pm-team-create__fields > label { row-gap: 9px; }
}

.form-section {
    border-top: 1px solid var(--border);
    display: grid;
    gap: 16px;
    padding-top: 18px;
}

.form-section:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.form-section h3 {
    margin: 0;
}

.form-static-field {
    border: 1px solid var(--border);
    border-radius: 6px;
    display: grid;
    gap: 5px;
    min-height: var(--control-height);
    min-width: 0;
    padding: 11px 12px;
}

.form-static-field span {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.form-static-field strong {
    color: var(--text);
    overflow-wrap: anywhere;
}

.compact-detail-grid {
    align-items: start;
    grid-template-columns: minmax(220px, 2fr) minmax(120px, 0.7fr);
}

.compact-checkbox-grid {
    gap: 8px;
}

.conditional-field[hidden] {
    display: none;
}

.competition-round-slot {
    display: grid;
    min-width: 0;
}

.competition-round-slot[hidden] {
    display: none;
}

.more-details,
.filter-details {
    display: grid;
    gap: var(--form-gap);
}

.more-details summary,
.filter-details summary {
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
    font-weight: 700;
    padding: 12px;
}

.more-details summary {
    align-items: center;
    display: flex;
    justify-content: space-between;
}

.more-details summary::after {
    color: var(--accent);
    content: "Open";
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.more-details[open] summary::after {
    content: "Close";
}

.more-details summary span {
    display: grid;
    gap: 3px;
}

.more-details summary small {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.more-details[open] summary,
.filter-details[open] summary {
    border-color: var(--accent);
}

.more-details > *,
.filter-details > * {
    margin-top: 0;
}

.page-heading h1,
.hero-panel h1 {
    margin-bottom: 10px;
}

.grid,
.card-grid,
.two-column,
.form-grid {
    display: grid;
    gap: var(--form-gap);
}

.two-column > *,
.form-grid > *,
.grid > *,
.form-section > *,
.button-row > *,
.row-actions > * {
    min-width: 0;
}

.grid {
    grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
    margin-bottom: 16px;
}

.two-column {
    grid-template-columns: 1fr;
    margin-bottom: 16px;
}

.form-grid {
    align-items: start;
    grid-template-columns: 1fr;
}

.panel.wide {
    width: 100%;
}

.page-shell .panel {
    width: 100%;
}

.panel h2 {
    margin: 0 0 18px;
}

.section-head {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 18px;
}

.section-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.button-row {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.section-head h2 {
    margin: 0;
}

.status-card span,
.list-row span,
.mini-card span,
.field-hint,
.muted,
.empty {
    color: var(--muted);
}

.field-hint {
    font-size: 0.85rem;
    line-height: 1.35;
    margin: 0;
}

.inline-text-action {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.inline-text-action:hover,
.inline-text-action:focus-visible {
    color: var(--accent-strong);
}

.status-card strong {
    font-size: 2rem;
}

.notice {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--panel);
    color: var(--text);
    padding: 12px 14px;
}

.notice.success {
    border-color: var(--accent);
}

.notice.error {
    border-color: var(--danger);
}

.notice.warning {
    border-color: var(--warning);
}

.checkbox-row {
    align-items: center;
    display: flex;
    gap: 10px;
    line-height: 1.35;
    min-height: 28px;
}

.checkbox-row input {
    flex: 0 0 auto;
    width: auto;
}

.segmented {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.segmented label {
    display: block;
}

.segmented input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segmented span {
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--muted);
    cursor: pointer;
    display: inline-flex;
    padding: 10px 12px;
}

.segmented input:checked + span {
    border-color: var(--accent);
    color: var(--text);
}

/* Native scope links reuse the segmented control without form or script behaviour. */
.segmented--links {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    flex-wrap: nowrap;
    gap: 0;
    width: fit-content;
}
.segmented--links a {
    align-items: center;
    border-right: 1px solid var(--border);
    color: var(--muted);
    display: inline-flex;
    flex: 1 1 0;
    font-family: var(--font-ui);
    font-size: 15px;
    font-weight: 600;
    justify-content: center;
    min-height: 44px;
    min-width: 100px;
    padding: 10px 12px;
    text-decoration: none;
}
.segmented--links a:first-child { border-radius: 5px 0 0 5px; }
.segmented--links a:last-child { border-radius: 0 5px 5px 0; border-right: 0; }
.segmented--links a[aria-current] { background: color-mix(in srgb, var(--accent) 14%, var(--panel)); color: var(--text); }
.segmented--links a:hover { color: var(--text); }

.checkbox-cluster {
    align-items: center;
}

/* Authenticated guided-flow presentation shared by Match entry, Season Setup and onboarding. */
[data-guided-nav="back"]::before {
    content: "\2190";
    margin-right: var(--pm-space-2);
}

[data-guided-nav="forward"]::after {
    content: "\2192";
    margin-left: var(--pm-space-2);
}

.pm-add-match-page .match-entry-content > .panel.guided-match-canvas,
.pm-guided-workspace {
    background: rgba(13, 27, 38, 0.97);
    border: 1px solid var(--pm-border);
    border-radius: 10px;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.24), inset 0 1px rgba(255, 255, 255, 0.035);
    padding: 24px;
}

.pm-add-match-page .guided-match-canvas .match-progress,
.pm-guided-progress {
    border-bottom: 1px solid var(--pm-border);
}

.pm-add-match-page .guided-match-canvas .match-progress ol,
.pm-guided-progress ol {
    margin: 0 auto;
    max-width: 860px;
}

/* Connected progress steps shared by guided setup journeys. */
.pm-guided-progress { min-width: 0; padding: 0 4px 17px; }
.pm-guided-progress ol { display: grid; grid-template-columns: repeat(var(--pm-guided-progress-steps), minmax(0, 1fr)); list-style: none; padding: 0; }
.pm-guided-progress li { align-items: center; color: var(--pm-text-disabled); display: grid; gap: var(--pm-space-2); justify-items: center; min-width: 0; position: relative; text-align: center; }
.pm-guided-progress li::before, .pm-guided-progress li::after { background: var(--pm-border); content: ""; height: 2px; position: absolute; top: 15px; width: 50%; }
.pm-guided-progress li::before { left: 0; }
.pm-guided-progress li::after { right: 0; }
.pm-guided-progress li:first-child::before, .pm-guided-progress li:last-child::after { display: none; }
.pm-guided-progress li.has-complete-before::before, .pm-guided-progress li.has-complete-after::after { background: var(--pm-green); }
.pm-guided-progress__number { align-items: center; background: var(--pm-bg-deep); border: 1px solid var(--pm-border); border-radius: 50%; display: inline-flex; font-size: var(--pm-type-caption); font-weight: 700; height: 30px; justify-content: center; position: relative; width: 30px; z-index: 1; }
.pm-guided-progress li.is-current { color: var(--pm-text-primary); }
.pm-guided-progress li.is-current .pm-guided-progress__number { border-color: var(--pm-green-highlight); box-shadow: 0 0 0 3px rgba(34, 197, 94, .12); color: var(--pm-green-soft); transform: scale(1.05); }
.pm-guided-progress li.is-complete { color: var(--pm-text-secondary); }
.pm-guided-progress li.is-complete .pm-guided-progress__number { background: var(--pm-green); border-color: var(--pm-green); color: var(--pm-bg-deep); font-size: 0; }
.pm-guided-progress li.is-complete .pm-guided-progress__number::before { content: "\2713"; font-size: 16px; font-weight: 800; line-height: 1; }
.pm-guided-progress li.is-complete.is-viewed .pm-guided-progress__number { outline: 2px solid var(--pm-green-highlight); outline-offset: 3px; }
.pm-guided-progress li.is-complete.is-viewed small { color: var(--pm-text-primary); font-weight: 700; }
.pm-guided-progress li small { font-size: var(--pm-type-caption); line-height: 1.25; }
.pm-guided-progress__mobile { display: none; }
@media (min-width: 768px) {
    .pm-guided-progress li:first-child:nth-last-child(2) { grid-template-columns: 30px minmax(0, 1fr); }
    .pm-guided-progress li:last-child:nth-child(2) { grid-template-columns: minmax(0, 1fr) 30px; }
    .pm-guided-progress li:first-child:nth-last-child(2) > :is(.pm-guided-progress__number, small) { grid-column: 1; }
    .pm-guided-progress li:last-child:nth-child(2) > :is(.pm-guided-progress__number, small) { grid-column: 2; }
    .pm-guided-progress li:first-child:nth-last-child(2)::after { left: 15px; right: auto; width: calc(100% - 15px); }
    .pm-guided-progress li:last-child:nth-child(2)::before { left: 0; width: calc(100% - 15px); }
}
@media (max-width: 767px) {
    .pm-guided-workspace { background: transparent; border: 0; border-radius: 0; box-shadow: none; padding: 0; }
}
@media (max-width: 520px) {
    .pm-guided-progress li small { display: none; }
    .pm-guided-progress__mobile { color: var(--pm-text-secondary); display: block; font-size: var(--pm-type-caption); margin: var(--pm-space-3) 0 0; text-align: center; }
}

.pm-guided-question-group {
    display: grid;
    gap: var(--pm-space-4);
    min-width: 0;
}

.pm-guided-question-group + .pm-guided-question-group,
.pm-add-match-page .guided-stage--3 > .guided-performance-group + .guided-performance-group,
[data-guided-performance-section] .guided-performance-group + .guided-performance-group {
    margin-top: var(--pm-add-section-gap, 32px);
    padding-top: var(--pm-add-section-gap, 32px);
}

.pm-guided-question-group + .pm-guided-question-group {
    border-top: 1px solid rgba(49, 80, 99, 0.58);
}

.pm-guided-question-heading {
    color: var(--pm-text-secondary);
    font-family: var(--font-ui);
    font-size: var(--pm-type-label);
    font-weight: 600;
    line-height: 1.35;
    margin: 0;
}

.pm-context-rail__step h2,
.pm-season-setup__guide h2,
.pm-season-setup__guide-body h2 {
    font-family: "Barlow Semi Condensed", "Arial Narrow", var(--font-ui);
    font-size: 22px;
    line-height: 1.2;
    margin: 0;
}

.pm-context-rail__step > p,
.pm-season-setup__guide p,
.pm-season-setup__guide-body p {
    color: var(--pm-text-secondary);
    font-size: var(--pm-type-support);
    line-height: 1.5;
    margin: 0;
}

/* Selected football reference shared by Match entry and Season Setup. */
.guided-selected-value {
    align-items: center;
    background: rgba(34, 197, 94, 0.07);
    border: 1px solid rgba(34, 197, 94, 0.54);
    border-radius: 8px;
    display: grid;
    gap: 12px;
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 56px;
    min-width: 0;
    padding: 6px 14px;
    width: 100%;
}

.guided-selected-value > span {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.guided-selected-value strong {
    color: var(--pm-text-primary);
    font-size: var(--pm-type-metadata);
    overflow-wrap: anywhere;
}

.guided-selected-value small {
    color: var(--pm-text-muted);
    font-size: var(--pm-type-caption);
}

.guided-selected-value button {
    background: transparent !important;
    border: 0 !important;
    color: var(--pm-green-soft) !important;
    font-size: var(--pm-type-action-compact);
    font-weight: 500;
    line-height: 1.4;
    min-height: 44px;
    padding: 8px 2px;
    width: auto;
    transition: color var(--pm-motion-fast) var(--pm-motion-ease), transform var(--pm-motion-fast) var(--pm-motion-ease);
}

.guided-selected-value button:active {
    transform: scale(0.98);
}

.guided-selected-value button:focus-visible {
    outline: 0;
}
