/* Tenant accents are decorative only: navigation underline and login-card top edge.
   Never use these tokens for text, controls, focus, selection or status. */
:root {
    --tenant-accent-primary: #285a8a;
    --tenant-accent-secondary: #6c8eab;
    --ui-primary: #285a8a;
    --ui-primary-hover: #20486f;
    --ui-primary-soft: #eaf0f6;
    --ui-secondary: #6c8eab;
    --ui-secondary-soft: #edf2f6;
    --ui-accent: #e7a160;
    --surface-page: #f5f7f6;
    --surface-card: #fff;
    --surface-muted: #eef3f0;
    --surface-nav: #17251d;
    --text-primary: #18231d;
    --text-secondary: #526159;
    --text-muted: #526159;
    --border-default: #d8e1dc;
    --success: #237a44;
    --success-soft: #e8f4ec;
    --warning: #9a570f;
    --warning-soft: #fff2df;
    --danger: #be2f2a;
    --danger-soft: #fcebea;
    --info: #2d6f8d;
    --info-soft: #e8f3f8;
    --radius-sm: .375rem;
    --radius-md: .625rem;
    --radius-lg: .875rem;
    --shadow-sm: 0 1px 2px rgba(24, 35, 29, .06);
    --transition-fast: 150ms ease;
    --bs-primary: var(--ui-primary);
    --bs-primary-rgb: 40, 90, 138;
    --bs-danger: var(--danger);
    --bs-body-font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

html {
    background: var(--surface-page);
}

body {
    background: var(--surface-page);
    color: var(--text-primary);
    font-family: var(--bs-body-font-family);
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: var(--ui-primary);
    text-underline-offset: .16em;
}

a:hover {
    color: var(--ui-primary-hover);
}

.club-nav {
    background: var(--surface-nav);
    border-bottom: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--tenant-accent-primary), var(--tenant-accent-secondary)) 1;
    box-shadow: 0 1px 3px rgba(16, 27, 21, .18);
    min-height: 64px;
}

.club-nav .container-fluid {
    max-width: 1540px;
}

.navbar-brand {
    align-items: center;
    display: inline-flex;
    gap: .65rem;
    letter-spacing: -.015em;
    margin-right: 1.5rem;
}

.brand-logo {
    background: #fff;
    border: 1px solid rgba(255, 255, 255, .65);
    border-radius: 50%;
    height: 40px;
    object-fit: contain;
    padding: 2px;
    width: 40px;
}

.brand-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.08;
}

.brand-copy small {
    color: #b9c6bf;
    font-size: .68rem;
    font-weight: 500;
    letter-spacing: .03em;
    margin-top: .18rem;
}

.club-nav .nav-link {
    border-radius: var(--radius-sm);
    color: #d7e0db;
    font-size: .91rem;
    font-weight: 520;
    margin: .15rem .08rem;
    padding: .55rem .72rem;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.club-nav .nav-link:hover, .club-nav .nav-link:focus-visible {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

.club-nav .nav-link.active {
    background: rgba(43, 136, 68, .25);
    box-shadow: inset 3px 0 0 #fff;
    font-weight: 750;
    color: #fff;
}

.nav-create {
    color: #fff !important;
    font-weight: 680 !important;
}

.user-menu {
    align-items: center;
    border-left: 1px solid rgba(255, 255, 255, .14);
    display: flex;
    gap: .75rem;
    margin-left: .75rem;
    padding-left: 1rem;
}

.user-name {
    color: #eef3f0;
    font-size: .86rem;
    max-width: 230px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-menu {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 28px rgba(24, 35, 29, .12);
    padding: .4rem;
}

.dropdown-item {
    border-radius: var(--radius-sm);
    font-size: .91rem;
    padding: .55rem .7rem;
}

.dropdown-item:active, .dropdown-item.active {
    background: var(--ui-primary);
}

.page-shell {
    margin: 0 auto;
    max-width: 1500px;
    padding: 1.75rem 2rem 3rem;
}

main {
    min-width: 0;
}

.page-title {
    color: var(--text-primary);
    font-size: clamp(1.55rem, 2vw, 1.85rem);
    font-weight: 720;
    letter-spacing: -.025em;
    line-height: 1.2;
    margin-bottom: .35rem;
}

.page-title + .text-secondary, .page-header .text-secondary {
    color: var(--text-secondary) !important;
    margin-bottom: 0;
    max-width: 760px;
}

.page-header {
    align-items: flex-start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.page-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.section-title {
    color: var(--text-primary);
    font-size: .78rem;
    font-weight: 720;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.card {
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-body {
    padding: 1.25rem;
}

.card .card {
    box-shadow: none;
}

.stat-card {
    border-left: 3px solid var(--ui-primary);
    min-height: 106px;
}

.stat-card small, .stat-card > span {
    color: var(--text-secondary);
    font-size: .78rem;
    font-weight: 650;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.stat-card strong {
    color: var(--text-primary);
    display: block;
    letter-spacing: -.035em;
    margin-top: .3rem;
}

.btn {
    border-radius: var(--radius-sm);
    font-weight: 620;
    min-height: 40px;
    padding: .46rem .85rem;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), color var(--transition-fast);
}

.btn-sm {
    min-height: 32px;
    padding: .3rem .58rem;
}

.btn-primary {
    --bs-btn-bg: var(--ui-primary);
    --bs-btn-border-color: var(--ui-primary);
    --bs-btn-hover-bg: var(--ui-primary-hover);
    --bs-btn-hover-border-color: var(--ui-primary-hover);
    --bs-btn-active-bg: var(--ui-primary-hover);
    --bs-btn-active-border-color: var(--ui-primary-hover);
}

.btn-outline-primary {
    --bs-btn-color: var(--ui-primary);
    --bs-btn-border-color: var(--ui-primary);
    --bs-btn-hover-bg: var(--ui-primary);
    --bs-btn-hover-border-color: var(--ui-primary);
}

.btn-outline-secondary, .btn-outline-dark {
    --bs-btn-color: #35443c;
    --bs-btn-border-color: #718078;
    --bs-btn-hover-bg: var(--surface-muted);
    --bs-btn-hover-border-color: #627268;
    --bs-btn-hover-color: var(--text-primary);
}

.btn-danger {
    --bs-btn-bg: var(--danger);
    --bs-btn-border-color: var(--danger);
}

.btn-link {
    color: var(--ui-primary);
}

.btn:focus-visible, .form-control:focus, .form-select:focus, .form-check-input:focus, .nav-link:focus-visible, a:focus-visible {
    outline: 3px solid #285a8a;
    outline-offset: 3px;
    box-shadow: 0 0 0 3px #fff;
}

.form-label {
    color: #2c3a32;
    font-size: .84rem;
    font-weight: 650;
    margin-bottom: .35rem;
}

.form-control, .form-select {
    border-color: #718078;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    min-height: 42px;
}

textarea.form-control {
    min-height: auto;
}

.form-control::placeholder {
    color: #526159;
}

.form-control:hover, .form-select:hover {
    border-color: #627268;
}

.form-check-input:checked {
    background-color: var(--ui-primary);
    border-color: var(--ui-primary);
}

.required::after {
    color: var(--danger);
    content: " *";
}

.form-hint {
    color: var(--text-muted);
    font-size: .8rem;
    margin-top: .3rem;
}

.text-danger {
    color: var(--danger) !important;
    font-size: .82rem;
}

.filter-toolbar {
    background: #fbfcfb;
    margin-bottom: 1rem;
}

.filter-toolbar.card-body {
    padding: 1rem;
}

.filter-toolbar .form-label {
    font-size: .76rem;
    margin-bottom: .25rem;
}

.filter-toolbar .form-control, .filter-toolbar .form-select, .filter-toolbar .btn {
    min-height: 38px;
}

.form-section {
    border-top: 1px solid var(--border-default);
    margin-top: 1rem;
    padding-top: 1rem;
}

.workflow-card {
    overflow: visible;
}

.workflow-step-title {
    align-items: center;
    display: flex;
    gap: .55rem;
    margin-bottom: .75rem;
}

.step-number {
    align-items: center;
    background: var(--ui-primary-soft);
    border: 1px solid #c2ddca;
    border-radius: 50%;
    color: var(--ui-primary);
    display: inline-flex;
    flex: 0 0 26px;
    font-size: .75rem;
    font-weight: 750;
    height: 26px;
    justify-content: center;
}

.workflow-actions {
    align-items: center;
    background: #fbfcfb;
    border-top: 1px solid var(--border-default);
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin: 1.25rem -1.25rem -1.25rem;
    padding: 1rem 1.25rem;
}

.designer-form > hr {
    border-color: var(--border-default);
    margin: 1.6rem 0 1.2rem;
    opacity: 1;
}

.designer-form > h2 {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 720;
}

.detail-facts dt {
    color: var(--text-muted);
    font-size: .76rem;
    font-weight: 650;
}

.detail-facts dd {
    color: var(--text-primary);
    font-size: .88rem;
}

.table {
    --bs-table-bg: transparent;
    --bs-table-hover-bg: #f7faf8;
    color: var(--text-primary);
    margin-bottom: 0;
}

.table thead th {
    background: var(--surface-muted);
    border-bottom: 1px solid var(--border-default);
    color: #536159;
    font-size: .72rem;
    font-weight: 720;
    letter-spacing: .045em;
    padding: .7rem .85rem;
    text-transform: uppercase;
    vertical-align: middle;
    white-space: nowrap;
}

.table td {
    border-color: #e6ece8;
    font-size: .88rem;
    padding: .72rem .85rem;
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table-actions {
    text-align: right;
    white-space: nowrap;
}

.document-number {
    color: var(--ui-primary);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-weight: 720;
    white-space: nowrap;
}

.truncate {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empty {
    color: var(--text-muted);
    padding: 2.6rem 1rem;
    text-align: center;
}

.empty::before {
    background: var(--ui-primary-soft);
    border-radius: 50%;
    color: var(--ui-primary);
    content: "—";
    display: block;
    font-weight: 750;
    height: 34px;
    line-height: 32px;
    margin: 0 auto .65rem;
    width: 34px;
}

.badge {
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 720;
    letter-spacing: .025em;
    padding: .34rem .58rem;
}

.badge-success, .text-bg-success {
    background: var(--success-soft) !important;
    border-color: #b9dcc5;
    color: #176434 !important;
}

.badge-warning, .text-bg-warning {
    background: var(--warning-soft) !important;
    border-color: #f0cf9d;
    color: #824509 !important;
}

.badge-danger {
    background: var(--danger-soft);
    border-color: #edc0bd;
    color: #a42420;
}

.badge-info {
    background: var(--info-soft);
    border-color: #bfdae7;
    color: #225e78;
}

.badge-neutral, .badge-soft, .text-bg-secondary {
    background: #edf1ef !important;
    border-color: #d3ddd7;
    color: #4c5b53 !important;
}

.upload-drop {
    align-items: center;
    background: var(--surface-muted);
    border: 1px dashed #a8b8ae;
    border-radius: .75rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 180px;
    padding: 1.5rem;
    text-align: center;
    transition: border-color .15s, background .15s;
}

.upload-drop:hover, .upload-drop:focus-within {
    background: #f4f8f5;
    border-color: var(--ui-primary);
}

.upload-drop .form-control {
    max-width: 620px;
}

.upload-title {
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 720;
}

.metadata-optional summary {
    cursor: pointer;
    list-style-position: outside;
}

.archive-file {
    align-items: center;
    border-bottom: 1px solid var(--border-default);
    display: flex;
    flex-wrap: wrap;
    gap: .9rem;
    padding: 1rem 0;
}

.archive-file:first-of-type {
    padding-top: .25rem;
}

.archive-file:last-child {
    border-bottom: 0;
    padding-bottom: .25rem;
}

.file-icon {
    align-items: center;
    background: #edf3ef;
    border: 1px solid #d5e0d9;
    border-radius: .55rem;
    color: #405449;
    display: flex;
    font-size: .68rem;
    font-weight: 800;
    height: 44px;
    justify-content: center;
    letter-spacing: .04em;
    width: 50px;
}

.file-copy {
    flex: 1 1 240px;
    min-width: 0;
}

.file-copy strong {
    display: block;
    overflow-wrap: anywhere;
}

.file-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

.file-actions form {
    margin: 0;
}

.archive-file .technical-details {
    margin-left: 66px;
}

.archive-void {
    opacity: .66;
}

.text-prewrap {
    white-space: pre-wrap;
}

.csv-preview {
    max-height: 68vh;
}

.csv-preview td {
    max-width: 360px;
    min-width: 100px;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.alert {
    border: 1px solid;
    border-radius: var(--radius-md);
    font-size: .9rem;
}

.alert-success {
    background: var(--success-soft);
    border-color: #b9dcc5;
    color: #176434;
}

.alert-danger {
    background: var(--danger-soft);
    border-color: #edc0bd;
    color: #8e211e;
}

.alert-warning {
    background: var(--warning-soft);
    border-color: #f0cf9d;
    color: #794107;
}

.alert-info {
    background: var(--info-soft);
    border-color: #bfdae7;
    color: #225e78;
}

.preview-frame {
    background: #fff;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    height: 720px;
    width: 100%;
}

.preview-card {
    top: 1rem;
}

.code-editor {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: .84rem;
    line-height: 1.55;
    min-height: 360px;
}

.selected-players {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    margin-bottom: .5rem;
    min-height: 44px;
    padding: .35rem;
}

.selected-player {
    align-items: center;
    background: #fbfcfb;
    border-bottom: 1px solid #e4ebe7;
    display: flex;
    gap: .7rem;
    padding: .62rem .65rem;
}

.selected-player:last-child {
    border-bottom: 0;
}

.placeholder-grid {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    max-height: 260px;
    overflow: auto;
}

.field-editor {
    border-bottom: 1px solid var(--border-default);
    padding: 1rem 0;
}

.field-editor:last-child {
    border-bottom: 0;
}

.asset-card {
    background: #fbfcfb;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    height: 100%;
    padding: .75rem;
}

.asset-preview {
    align-items: center;
    background: #fff;
    border: 1px dashed #b8c5bd;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    display: flex;
    font-size: .78rem;
    height: 112px;
    justify-content: center;
    margin-bottom: .7rem;
    overflow: hidden;
    padding: .5rem;
    text-align: center;
}

.asset-preview img {
    max-height: 96px;
    max-width: 100%;
    object-fit: contain;
}

.asset-preview-watermark img {
    opacity: .3;
}

.snapshot {
    max-height: 420px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.technical-details summary {
    color: var(--ui-primary);
    cursor: pointer;
    font-weight: 650;
}

.technical-details[open] summary {
    margin-bottom: 1rem;
}

.pagination {
    --bs-pagination-color: var(--ui-primary);
    --bs-pagination-active-bg: var(--ui-primary);
    --bs-pagination-active-border-color: var(--ui-primary);
}

.login-page {
    background: linear-gradient(135deg, #f1f5f2 0, #f8f9f8 62%, #fff3e9 100%);
}

.login-shell {
    padding: 1.25rem;
    width: 100%;
}

.login-card {
    margin: 0 auto;
    max-width: 420px;
    overflow: visible;
    padding: 2rem;
    position: relative;
}

.login-card::before {
    background: linear-gradient(90deg, var(--tenant-accent-primary), var(--tenant-accent-secondary));
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    content: "";
    height: 4px;
    left: -1px;
    position: absolute;
    right: -1px;
    top: -1px;
}

.login-brand {
    align-items: center;
    display: flex;
    gap: .85rem;
    margin-bottom: 1.5rem;
}

.login-logo {
    height: 64px;
    object-fit: contain;
    width: 64px;
}

.login-monogram, .brand-monogram {
    align-items: center;
    background: var(--ui-primary-soft);
    color: var(--ui-primary);
    display: inline-flex;
    flex: 0 0 auto;
    font-weight: 800;
    justify-content: center;
}

.login-monogram {
    border-radius: 16px;
    font-size: 1.7rem;
    height: 64px;
    width: 64px;
}

.brand-monogram {
    border-radius: 10px;
    font-size: 1.15rem;
    height: 40px;
    width: 40px;
}

.login-brand h1 {
    font-size: 1.4rem;
    margin: 0;
}

.login-brand p {
    color: var(--text-secondary);
    font-size: .87rem;
    margin: .2rem 0 0;
}

.login-help {
    color: var(--text-muted);
    font-size: .78rem;
    margin: 1.25rem 0 0;
    text-align: center;
}

@media print {
    .club-nav, .no-print, .btn, form {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .page-shell {
        max-width: none;
        padding: 0;
    }

    .card {
        border: 0;
        box-shadow: none;
    }

    .table {
        font-size: 10pt;
    }
}

@media (max-width: 991.98px) {
    .club-nav .navbar-collapse {
        border-top: 1px solid rgba(255, 255, 255, .12);
        margin-top: .65rem;
        padding: .65rem 0 .8rem;
    }

    .club-nav .nav-link {
        padding: .62rem .75rem;
    }

    .user-menu {
        border-left: 0;
        border-top: 1px solid rgba(255, 255, 255, .12);
        justify-content: space-between;
        margin: .6rem 0 0;
        padding: .8rem 0 0;
    }

    .preview-card {
        position: static !important;
    }
}

@media (min-width: 992px) and (max-width: 1100px) {
    .navbar-brand {
        gap: .45rem;
        margin-right: .65rem;
    }

    .club-nav .nav-link {
        padding-left: .5rem;
        padding-right: .5rem;
    }

    .user-menu {
        gap: .45rem;
        margin-left: .35rem;
        padding-left: .55rem;
    }

    .user-name {
        max-width: 145px;
    }
}

@media (max-width: 767.98px) {
    .page-shell {
        padding: 1.15rem .9rem 2rem;
    }

    .page-header, main > .d-flex.justify-content-between {
        align-items: stretch !important;
        flex-direction: column;
    }

    .page-header-actions, main > .d-flex.justify-content-between > .btn, main > .d-flex.justify-content-between > a.btn {
        align-self: stretch !important;
    }

    .page-header-actions .btn {
        flex: 1 1 auto;
    }

    .card-body {
        padding: 1rem;
    }

    .stat-card {
        min-height: 96px;
    }

    .table-responsive {
        font-size: .9rem;
    }

    .table {
        min-width: 720px;
    }

    .selected-player {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .selected-player .btn-group {
        margin-left: 0 !important;
        width: 100%;
    }

    .selected-player .btn {
        flex: 1;
    }

    .preview-frame {
        height: 540px;
    }
}

@media (max-width: 420px) {
    .navbar-brand {
        gap: .45rem;
        margin-right: .25rem;
    }

    .brand-logo {
        height: 36px;
        width: 36px;
    }

    .brand-copy strong {
        max-width: 215px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .brand-copy small {
        display: none;
    }

    .login-card {
        padding: 1.4rem;
    }

    .login-logo {
        height: 54px;
        width: 54px;
    }

    .btn:not(.btn-sm) {
        width: 100%;
    }

    .page-header-actions {
        width: 100%;
    }
}

/* Keep Bootstrap states on the same fixed palette, including disabled controls. */
.btn-primary {
    --bs-btn-disabled-bg: var(--ui-primary);
    --bs-btn-disabled-border-color: var(--ui-primary);
    --bs-btn-disabled-opacity: 1;
}
.btn:disabled, .btn.disabled { cursor: not-allowed; border-style: dashed; }
.form-check-input { border-color: #718078; }
.club-nav a:focus-visible, .navbar-toggler:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
    box-shadow: none;
}

/* Keep every report column inside the printed page, including narrow A4 viewports. */
@media print {
    .report-page .table-responsive {
        overflow: visible;
    }

    .report-page .table {
        min-width: 0;
        width: 100%;
        table-layout: fixed;
    }

    .report-page .table th,
    .report-page .table td {
        font-size: 8pt;
        padding: .3rem .25rem;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .report-page .table .truncate {
        max-width: none;
        overflow: visible;
        text-overflow: clip;
    }

    .report-page .table th:nth-child(1) { width: 17%; }
    .report-page .table th:nth-child(2) { width: 12%; }
    .report-page .table th:nth-child(3) { width: 10%; }
    .report-page .table th:nth-child(4) { width: 17%; }
    .report-page .table th:nth-child(5) { width: 15%; }
    .report-page .table th:nth-child(6) { width: 16%; }
    .report-page .table th:nth-child(7) { width: 13%; }

    .report-page .badge {
        background: transparent !important;
        border: 0;
        border-radius: 0;
        color: #000 !important;
        display: inline;
        font-size: inherit;
        font-weight: 600;
        letter-spacing: 0;
        padding: 0;
        white-space: normal;
    }

    .report-page .table tr {
        break-inside: avoid;
    }
}
