/* ============================================================
   SCHAAKMAAT.CSS  —  Stijlen voor SchaakMaat toernooi-assistent
   Schaak maar raak Academy
   ============================================================ */


/* ============================================================
   1. DESIGN TOKENS
   ============================================================ */
:root {
    /* Papier & inkt */
    --parchment:      #f5eedf;
    --parchment-mid:  #ede4cf;
    --parchment-dark: #e4d8bf;
    --parchment-deep: #d6c9aa;

    --ink:            #1a1209;
    --ink-mid:        #3d2f1a;
    --ink-light:      #7a6a55;

    /* Accenten */
    --burgundy:       #6b1414;
    --gold:           #9a7530;
    --gold-light:     #b8924a;
    --rule:           #c8b89a;
    --rule-heavy:     #8c7355;

    /* Knoppen */
    --btn-primary-bg:   #6b1414;
    --btn-primary-text: #f5eedf;
    --btn-primary-hover:#4e0f0f;

    /* Fonts */
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body:    'Libre Baskerville', Georgia, serif;
    --font-ui:      'Montserrat', sans-serif;

    /* Layout */
    --max-width: 1100px;
}


/* ============================================================
   2. RESET & BASIS
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
html, body { overflow-x: hidden; }

body {
    background-color: var(--parchment-mid);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-attachment: scroll;
    font-family: var(--font-body);
    color: var(--ink);
    font-size: 16px;
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body::before,
body::after {
    content: '';
    position: fixed;
    top: 50%;
    transform: translateY(calc(-50% + 40px));
    height: 680px;
    width: 600px;
    background-image: url("../images/uil.png");
    background-size: auto 680px;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 0;
}
body::before {
    left: -259px;
    background-position: left center;
}
body::after {
    right: -259px;
    background-position: right center;
}


/* ============================================================
   3. SITE-HEADER
   ============================================================ */
.site-header {
    background: var(--parchment);
    border-bottom: 2px solid var(--rule-heavy);
    padding: 8px 20px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    position: relative;
}

.site-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--rule-heavy), var(--gold-light), var(--rule-heavy));
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}

.header-logo-icon {
    width: 52px;
    height: 52px;
    background-color: var(--ink);
    background-image: url('../images/logo-icon.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 55%;
    flex-shrink: 0;
    border: 2px solid var(--rule-heavy);
}

.header-logo-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.3;
}

.logo-main {
    font-family: var(--font-ui);
    font-weight: 900;
    font-size: 1rem;
    font-variant-caps: all-small-caps;
    color: var(--burgundy);
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.logo-sub {
    font-family: var(--font-ui);
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: var(--ink-light);
    text-align: center;
}

.header-title {
    font-family: var(--font-ui);
    font-size: clamp(1.2rem, 3vw, 2rem);
    font-weight: 600;
    letter-spacing: 0.08em;
    font-variant-caps: small-caps;
    color: var(--burgundy);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    pointer-events: none;
}

.header-title span {
    font-weight: 500;
    color: var(--ink-mid);
}

.header-actions {
    display: flex;
    align-items: center;
    justify-self: end;
}

.info-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--ink);
    color: var(--parchment);
    font-family: var(--font-body);
    font-style: italic;
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    flex-shrink: 0;
}
.info-btn:hover { background: var(--burgundy); }

/* Info modal */
.info-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26,18,9,0.75);
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.17s;
}
.info-overlay.open { opacity: 1; pointer-events: all; }

.info-modal {
    background: var(--parchment);
    border: 1px solid var(--rule-heavy);
    border-top: 4px solid var(--burgundy);
    padding: 1.5rem;
    width: 420px;
    max-width: 92vw;
    box-shadow: 0 8px 32px rgba(26,18,9,0.3);
}

.info-modal h3 {
    font-family: var(--font-display);
    color: var(--burgundy);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.info-modal-body {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}

.info-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.88rem;
}

.info-label {
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-light);
    min-width: 110px;
    white-space: nowrap;
}

.info-links {
    padding-top: 0.5rem;
    border-top: 1px solid var(--rule);
}

.info-link {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--burgundy);
    text-decoration: none;
}
.info-link:hover { text-decoration: underline; }

.info-copyright {
    padding-top: 0.6rem;
    border-top: 1px solid var(--rule);
    font-size: 0.75rem;
    color: var(--ink-light);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.info-modal-btns {
    display: flex;
    justify-content: flex-end;
}


/* ============================================================
   4. TOOLBAR
   ============================================================ */
.toolbar-bar {
    background: var(--parchment);
    border-bottom: 2px solid var(--rule-heavy);
    position: sticky;
    top: 0;
    z-index: 500;
    box-shadow: 0 2px 8px rgba(26,18,9,0.08);
}

.toolbar-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    min-height: 48px;
}

/* Alle knoppen in de toolbar */
.toolbar-btn {
    font-family: var(--font-ui);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    background: none;
    color: var(--ink-mid);
    border: 1px solid var(--rule-heavy);
    padding: 5px 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    line-height: 1.6;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 0;
    text-decoration: none;
}

.toolbar-btn:hover {
    background: var(--ink);
    color: var(--parchment);
    border-color: var(--ink);
}

.toolbar-icon {
    font-size: 0.7rem;
    line-height: 1;
}

.toolbar-import-label { cursor: pointer; }
.toolbar-import-label input[type="file"] { display: none; }

.toolbar-btn-group {
    display: inline-flex;
    align-items: stretch;
    align-self: stretch;
    overflow: hidden;
}

.toolbar-btn-group .toolbar-btn {
    border-radius: 0;
    padding: 0 18px;
    align-self: stretch;
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border: 1px solid var(--btn-primary-bg);
    height: 100%;
}

.toolbar-btn-group .toolbar-btn:hover {
    background: var(--btn-primary-hover);
    border-color: var(--btn-primary-hover);
    color: var(--btn-primary-text);
}

.toolbar-btn-group .toolbar-btn + .toolbar-btn {
    border-left: 1px solid rgba(245, 238, 223, 0.25);
}

.toolbar-btn-group .toolbar-btn:disabled {
    background: var(--parchment-dark);
    color: var(--ink-light);
    border-color: var(--rule-heavy);
    border-left-color: var(--rule);
    opacity: 0.6;
    cursor: not-allowed;
}

.toolbar-btn-group .toolbar-btn:disabled:hover {
    background: var(--parchment-dark);
    color: var(--ink-light);
    border-color: var(--rule-heavy);
    transform: none;
}

.toolbar-reset-btn {
    background: var(--parchment-dark) !important;
    color: var(--ink-mid) !important;
    border-left: 1px solid var(--rule) !important;
    border-color: var(--rule-heavy) !important;
}

.toolbar-reset-btn:hover {
    background: var(--burgundy) !important;
    color: var(--parchment) !important;
    border-color: var(--burgundy) !important;
}

.beamer-controls {
    margin-left: auto;
    padding-left: 10px;
}

.beamer-interval-wrap {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0 10px;
    border-left: 1px solid rgba(245,238,223,0.15);
}

.beamer-interval-input {
    width: 48px;
    padding: 3px 4px;
    text-align: center;
    font-family: var(--font-ui);
    font-size: 0.72rem;
    font-weight: 700;
    border: 1px solid var(--rule-heavy);
    background: var(--parchment-dark);
    color: var(--ink);
    -moz-appearance: textfield;
}
.beamer-interval-input::-webkit-inner-spin-button,
.beamer-interval-input::-webkit-outer-spin-button { opacity: 1; }

.beamer-interval-unit {
    font-family: var(--font-ui);
    font-size: 0.62rem;
    color: var(--ink-light);
    white-space: nowrap;
}


/* ============================================================
   5. VIEWER-WRAP
   ============================================================ */
.viewer-wrap {
    max-width: var(--max-width);
    margin: 2rem auto 0;
    padding: 0 1.5rem;
    width: 100%;
    flex: 1 0 auto;
}


/* ============================================================
   6. PRIMAIRE TABS
   ============================================================ */
.tabs-bar {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    border-bottom: 2px solid var(--rule-heavy);
    background: var(--parchment);
    flex-wrap: wrap;
}

.main-tabs { display: flex; }

.tab-btn {
    font-family: var(--font-ui);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-light);
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 0.75rem 1.4rem;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--ink);
    background: var(--parchment-dark);
}

.tab-btn.active {
    color: var(--burgundy);
    border-bottom-color: var(--burgundy);
    background: var(--parchment-mid);
}

.final-tab-actions {
    display: flex;
    margin-left: auto;
}

.final-action-btn {
    border-left: 1px solid var(--rule);
}

.final-action-btn:disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

/* Tab-inhoud */
.tab-panel {
    display: none;
    background: var(--parchment);
    border: 1px solid var(--rule);
    border-top: none;
}

.tab-panel.active { display: block; }


/* ============================================================
   6b. SECUNDAIRE GROEPTABS
   ============================================================ */
.group-tabs-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    background: var(--parchment-mid);
    border: 1px solid var(--rule);
    border-top: none;
    border-bottom: 2px solid var(--gold-light);
    padding: 0.35rem 0.75rem;
}

.group-tab-btn {
    font-family: var(--font-ui);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-light);
    background: none;
    border: 1px solid transparent;
    padding: 0.4rem 1rem;
    margin: 0.15rem 0.2rem;
    cursor: pointer;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
    white-space: nowrap;
    border-radius: 0;
}

.group-tab-btn:hover {
    color: var(--ink);
    background: var(--parchment-dark);
    border-color: var(--rule);
}

.group-tab-btn.active {
    color: var(--gold);
    border-color: var(--gold-light);
    background: var(--parchment);
}

.group-tab-btn.dirty {
    color: #b84a00;
    border-color: #e09060;
}

.group-tab-btn.dirty.active {
    color: #b84a00;
    border-color: #b84a00;
}

.group-tab-btn.complete {
    color: #1a5c2a;
    background: #d4edda;
    border-color: #6abf7b;
}

.group-tab-btn.complete.active {
    color: #1a5c2a;
    background: #c3e6cb;
    border-color: #3d9b52;
}


/* ============================================================
   7. PANEL HEADER
   ============================================================ */
.panel-header {
    padding: 0.65rem 1.25rem 0.55rem;
    border-bottom: 1px solid var(--rule);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--parchment-mid);
}

.panel-title {
    font-family: var(--font-ui);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--ink-mid);
    white-space: nowrap;
}

.panel-rule {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--rule), transparent);
}

.panel-body { padding: 1.5rem 1.25rem; }


/* ============================================================
   8. FORMULIEREN
   ============================================================ */
.form-row { margin-bottom: 1.1rem; }

.form-row label, label {
    display: block;
    font-family: var(--font-ui);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-light);
    margin-bottom: 0.35rem;
}

.required { color: var(--burgundy); font-style: normal; }

input[type="text"],
input[type="date"],
input[type="number"],
textarea {
    width: 100%;
    padding: 3px 6px;
    background: var(--parchment-mid);
    color: var(--ink);
    border: 1px solid var(--rule-heavy);
    border-radius: 0;
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input[type="text"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(154,117,48,0.12);
}

/* Verberg pijltjes in number-inputs (behalve groepsgrootte-inputs) */
input[type="number"]:not(.gpt-count-input) { -moz-appearance: textfield; }
input[type="number"]:not(.gpt-count-input)::-webkit-inner-spin-button,
input[type="number"]:not(.gpt-count-input)::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* Zorg dat de spinner-pijltjes goed zichtbaar zijn in de groepsgrootte-inputs */
.gpt-count-input { -moz-appearance: number-input; }
.gpt-count-input::-webkit-inner-spin-button { -webkit-appearance: inner-spin-button; opacity: 1; }

textarea { resize: vertical; }

select {
    padding: 0.5rem 0.75rem;
    background: var(--parchment-mid);
    color: var(--ink);
    border: 1px solid var(--rule-heavy);
    border-radius: 0;
    font-family: var(--font-ui);
    font-size: 0.82rem;
    cursor: pointer;
    transition: border-color 0.15s;
}

select:focus { outline: 1px solid var(--gold); }

.input-row { display: flex; gap: 0.6rem; align-items: center; }
.input-row input[type="text"] { flex: 1; }

.form-inline {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.form-inline label { margin: 0; white-space: nowrap; }
.form-inline select { min-width: 200px; }

#tournamentInfoForm { max-width: 520px; }

/* Kleine invoervelden */
.group-letter-input {
    width: 64px !important;
    text-align: center;
    font-weight: 700;
    font-family: var(--font-ui);
    text-transform: uppercase;
}

.small-number-input {
    width: 90px !important;
}


/* ============================================================
   9. KNOPPEN
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-ui);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    padding: 0.55rem 1.3rem;
    border-radius: 0;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
    border: 1px solid transparent;
    white-space: nowrap;
    text-decoration: none;
}

.btn:hover { transform: translateY(-1px); }

.btn-primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border-color: var(--btn-primary-bg);
}

.btn-primary:hover {
    background: var(--btn-primary-hover);
    border-color: var(--btn-primary-hover);
}

.btn-secondary {
    background: none;
    color: var(--ink-mid);
    border-color: var(--rule-heavy);
}

.btn-secondary:hover {
    background: var(--ink);
    color: var(--parchment);
    border-color: var(--ink);
}

.btn-danger {
    background: none;
    color: #b92a2a;
    border-color: #b92a2a;
}
.btn-danger:hover {
    background: #b92a2a;
    color: #fff;
    border-color: #b92a2a;
}

.btn-secondary:disabled,
.btn-secondary[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary:disabled:hover {
    background: none;
    color: var(--ink-mid);
    border-color: var(--rule-heavy);
}

.button-container { display: flex; gap: 0.6rem; flex-wrap: wrap; }


/* ============================================================
   10. SPELERSTABBLAD — INVOERFORMULIER
   ============================================================ */
.add-player-form {
    background: var(--parchment-mid);
    border: 1px solid var(--rule);
    border-left: 3px solid var(--gold);
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.name-dob-row {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}
.name-dob-row .form-row:first-child { flex: 1; }
.name-dob-row .form-row:last-child  { flex: 0 0 150px; }

.add-player-fields {
    display: grid;
    grid-template-columns: 1fr 120px 80px;
    gap: 0 1rem;
}

/* ============================================================
   11. SPELERSTABEL
   ============================================================ */
ul { list-style: none; padding: 0; }

#playerList { margin-top: 0.5rem; }

.player-list-empty {
    font-family: var(--font-body);
    font-style: italic;
    color: var(--ink-light);
    font-size: 0.88rem;
    padding: 0.5rem 0;
    margin: 0;
}

/* Tabel */
.player-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-body);
    font-size: 0.88rem;
}

.player-table thead th {
    background: var(--ink);
    color: var(--parchment);
    font-family: var(--font-ui);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--ink-mid);
    text-align: left;
    white-space: nowrap;
}

.player-table thead th.sortable {
    cursor: pointer;
    user-select: none;
}

.player-table thead th.sortable:hover {
    background: var(--ink-mid);
}

.player-table thead th.sorted {
    color: var(--gold-light);
}

.player-table tbody tr {
    border-bottom: 1px solid var(--rule);
    transition: background 0.12s;
}

.player-table tbody tr:nth-child(even) { background: var(--parchment-mid); }
.player-table tbody tr:hover { background: var(--parchment-dark); }

.player-table tbody tr.unassigned {
    border-left: 3px solid #c07030;
    background: #fdf4ec;
}
.player-table tbody tr.unassigned:hover { background: #f8e8d8; }

.player-table td {
    padding: 0.45rem 0.75rem;
    vertical-align: middle;
    border-right: 1px solid var(--rule);
}

.player-table td:last-child { border-right: none; }

.pt-name { font-weight: 700; color: var(--ink); min-width: 140px; }
.pt-dob  { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink-mid); width: 110px; }

.pt-name-btn {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-weight: 700;
    color: var(--ink);
    cursor: pointer;
    text-align: left;
    text-decoration: underline dotted var(--ink-mid);
    text-underline-offset: 3px;
}
.pt-name-btn:hover { color: var(--gold-dark); text-decoration-color: var(--gold-dark); }

.player-table tbody tr.editing {
    background: #fffbea !important;
    outline: 2px solid var(--gold);
    outline-offset: -2px;
}
.pt-club { color: var(--ink-mid); }
.pt-elo  { text-align: right; font-variant-numeric: tabular-nums; width: 70px; color: var(--ink-mid); }
.pt-group { text-align: center; width: 70px; }
.pt-actions { white-space: nowrap; width: 1%; }

/* Groepsbadge */
.group-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: var(--badge-color, var(--burgundy));
    color: #fff;
    font-family: var(--font-ui);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    border-radius: 0;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.15);
}

.unassigned-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    color: #c07030;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 700;
    border: 1px dashed #c07030;
    flex-shrink: 0;
}

.draggable-list li { cursor: grab; user-select: none; }
.draggable-list li:active { cursor: grabbing; }
.draggable-list li.over { border-top: 2px solid var(--gold-light); }

.edit-btn,
.delete-btn {
    font-family: var(--font-ui);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 3px 10px;
    border: 1px solid;
    border-radius: 0;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.edit-btn {
    background: none;
    color: var(--ink-light);
    border-color: var(--rule-heavy);
}

.edit-btn:hover {
    background: var(--ink);
    color: var(--parchment);
    border-color: var(--ink);
}

.delete-btn {
    background: none;
    color: var(--burgundy);
    border-color: var(--burgundy);
}

.delete-btn:hover {
    background: var(--burgundy);
    color: var(--parchment);
}


/* ============================================================
   12. INSTELLINGEN-TAB
   ============================================================ */
.settings-grid { max-width: 600px; }

.settings-subsection {
    margin-top: 1.5rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--rule);
}
.settings-subsection-title {
    font-family: var(--font-ui);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-light);
    margin-bottom: 0.75rem;
}
.tiebreak-grid { display: flex; flex-direction: column; gap: 0.5rem; max-width: 520px; }
.tiebreak-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.tiebreak-label { font-size: 0.88rem; color: var(--ink-mid); }
.tiebreak-desc { font-size: 0.78rem; color: var(--ink-light); }
.tiebreak-select { font-family: var(--font-ui); font-size: 0.75rem; padding: 3px 6px; border: 1px solid var(--rule-heavy); background: var(--parchment); color: var(--ink); min-width: 130px; }
.ppg-hint { font-size: 0.8rem; color: var(--ink-light); font-family: var(--font-ui); margin-left: 0.5rem; }

.group-preview-table { border-collapse: collapse; width: 100%; max-width: 520px; margin-top: 0.25rem; }
.group-preview-table th { font-family: var(--font-ui); font-size: 0.68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-light);
    padding: 0.25rem 0.75rem 0.4rem; text-align: left; border-bottom: 1px solid var(--rule); }
.group-preview-table td { padding: 0.35rem 0.75rem; font-size: 0.85rem;
    border-bottom: 1px solid var(--rule-light); }
.group-preview-table tbody tr:last-child td { border-bottom: none; }
.gpt-key { font-weight: 600; color: var(--ink); width: 100px; }
.gpt-count { color: var(--ink-mid); font-family: var(--font-ui); font-size: 0.8rem; width: 120px; }
.gpt-count-input { font-family: var(--font-ui); font-size: 0.82rem; width: 68px;
    padding: 2px 4px; border: 1px solid var(--rule-heavy); background: var(--parchment);
    color: var(--ink); text-align: center; }
.gpt-select { font-family: var(--font-ui); font-size: 0.78rem; padding: 3px 6px;
    border: 1px solid var(--rule-heavy); background: var(--parchment); color: var(--ink); }

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.2rem;
}

.radio-label {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-body) !important;
    font-size: 0.88rem !important;
    font-weight: 400 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    color: var(--ink-mid) !important;
    cursor: pointer;
    margin: 0 !important;
}

.radio-label input[type="radio"] {
    width: auto;
    height: auto;
    padding: 0;
    border: none;
    background: none;
    accent-color: var(--burgundy);
    cursor: pointer;
    margin: 0;
    flex-shrink: 0;
}

.settings-info-msg {
    font-family: var(--font-body);
    font-size: 0.88rem;
    color: var(--ink-mid);
    margin-top: 1rem;
    padding: 0.6rem 1rem;
    background: var(--parchment-mid);
    border: 1px solid var(--rule);
    border-left: 3px solid #2d6a2d;
}

.settings-info-msg strong { color: var(--ink); }


/* ============================================================
   13. DIRTY-BANNER & SECTIEVERDELER
   ============================================================ */
.dirty-banner {
    background: #fff8e8;
    border: 1px solid #e09060;
    border-left: 4px solid #b84a00;
    color: #7a3500;
    font-family: var(--font-ui);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.65rem 1.25rem;
}

.section-divider {
    border: none;
    border-top: 2px solid var(--rule);
    margin: 1.5rem 0;
    background: linear-gradient(90deg, var(--gold), transparent);
    height: 1px;
    border-top: none;
}


/* ============================================================
   14. SPEELSCHEMA (ronden & partijen)
   ============================================================ */
.round h3 {
    font-family: var(--font-ui);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--ink-light);
    margin-bottom: 0.7rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--rule);
}

.round { margin-bottom: 1.5rem; }

.match {
    background: var(--parchment-mid);
    border: 1px solid var(--rule);
    padding: 0.45rem 1rem;
    margin-bottom: 0.35rem;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.12s;
}

.match:hover { background: var(--parchment-dark); }

.match-content {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 600px;
}

.player {
    flex: 1;
    font-family: var(--font-body);
    font-size: 0.88rem;
    text-align: center;
}

.player.left  { text-align: right;  padding-right: 0.5rem; }
.player.right { text-align: left;   padding-left:  0.5rem; }

.result {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 8px;
}

.result select {
    width: auto;
    min-width: 72px;
    padding: 3px 6px;
    font-size: 0.82rem;
    border-color: var(--rule-heavy);
}

.match select { margin: 0 0.4rem; }

.bye {
    font-family: var(--font-ui);
    font-size: 0.65rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-light);
    margin: 0 8px;
}


/* ============================================================
   15. SCORETABEL
   ============================================================ */
#resultsDiagram,
#groupPanel .score-table-wrap {
    overflow-x: auto;
}

#resultsDiagram table {
    border-collapse: collapse;
    width: 100%;
    font-family: var(--font-body);
    font-size: 0.84rem;
}

#resultsDiagram th {
    background: var(--ink);
    color: var(--parchment);
    font-family: var(--font-ui);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--ink-mid);
    text-align: center;
}

#resultsDiagram td {
    border: 1px solid var(--rule);
    padding: 0.38rem 0.6rem;
    text-align: center;
    color: var(--ink) !important;
}

#resultsDiagram tr:nth-child(even) td { background: var(--parchment-mid); }
#resultsDiagram tr:hover td { background: var(--parchment-dark); }

.player-number {
    width: 30px;
    text-align: right;
    padding-right: 5px !important;
    color: var(--ink-light);
    font-family: var(--font-ui);
    font-size: 0.7rem;
}

.score-elo {
    font-size: 0.78em;
    color: var(--ink-mid);
    font-weight: 400;
}

#resultsDiagram .player-name {
    text-align: left !important;
    padding-left: 8px !important;
    font-weight: 700;
    white-space: nowrap;
}

.result-cell            { width: 36px; font-family: var(--font-ui); font-variant-numeric: tabular-nums; }
#resultsDiagram .result-cell  { width: 34px; white-space: nowrap; }
#resultsDiagram .total-score  { width: 52px; white-space: nowrap; font-weight: 700; color: var(--parchment); font-family: var(--font-ui); font-variant-numeric: tabular-nums; }
#resultsDiagram td.total-score { color: var(--burgundy) !important; }
#resultsDiagram .score-sb     { width: 46px; white-space: nowrap; font-family: var(--font-ui); font-variant-numeric: tabular-nums; }
#resultsDiagram .score-wins   { width: 32px; white-space: nowrap; font-family: var(--font-ui); font-variant-numeric: tabular-nums; }
.ranking                { width: 40px; white-space: nowrap; font-weight: 700; font-family: var(--font-ui); font-variant-numeric: tabular-nums; color: var(--gold); }
#resultsDiagram td.ranking { color: var(--burgundy) !important;}

.result-cell--clickable {
    cursor: pointer;
    user-select: none;
    transition: background 0.1s;
}
.result-cell--clickable:hover { background: var(--parchment-deep) !important; }

.bye-header { color: var(--ink-light) !important; font-style: italic; }
.bye-result-cell { color: var(--ink-light); }
#resultsDiagram .bye-row td { background: var(--parchment-dark) !important; border-top: 1px solid var(--rule); }
.bye-name { color: var(--ink-light) !important; font-style: italic; font-weight: 400 !important; }
.result-cell--clickable.cell-empty { color: transparent; }

#resultsDiagram .player-name.leader,
.sm-naam.leader {
    color: #1a6b2d !important;
    font-weight: 700;
}

.score-table-hint {
    font-size: 0.75rem;
    color: var(--ink-light);
    font-style: italic;
    margin: 0.4rem 0 0;
    font-family: var(--font-ui);
}


/* ============================================================
   17. FOOTER
   ============================================================ */
.site-footer {
    text-align: center;
    margin-top: auto;
    padding: 1.25rem 1rem;
    border-top: 1px solid var(--rule);
    font-family: var(--font-display);
    font-style: italic;
    font-size: 0.85rem;
    color: var(--ink-light);
    background: var(--parchment-mid);
}

.site-footer a { color: var(--ink-light); text-decoration: none; }
.site-footer a:hover { color: var(--burgundy); }


/* ============================================================
   18. RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
    body::before,
    body::after { display: none; }
}

@media (max-width: 720px) {
    .toolbar-inner {
        flex-wrap: wrap;
        padding: 0.4rem 1rem;
        gap: 0.4rem;
        min-height: auto;
    }

    .viewer-wrap { padding: 0 0.75rem; }

    .tabs-bar { flex-wrap: wrap; }
    .tab-btn { padding: 0.65rem 0.9rem; font-size: 0.58rem; }

    .name-dob-row { flex-direction: column; }
    .name-dob-row .form-row:last-child { flex: 0 0 auto; width: 100%; }
    .add-player-fields { grid-template-columns: 1fr; }

    .form-inline { flex-direction: column; align-items: flex-start; }
    .form-inline select { min-width: 100%; width: 100%; }

    .button-container { flex-direction: column; }

    .input-row { flex-direction: column; align-items: stretch; }
    .input-row .btn { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
    .header-logo-text { display: none; }
    .header-title { font-size: 1.1rem; }
    .panel-body { padding: 1rem; }
    .match-content { max-width: 100%; }
    .add-player-form { padding: 0.8rem; }
}


/* ============================================================
   TOAST-MELDINGEN
   ============================================================ */
.sm-toast {
    position: fixed;
    top: 1.2rem;
    left: 50%;
    transform: translateX(-50%) translateY(-120%);
    z-index: 99999;
    padding: 0.7rem 1.6rem;
    font-family: var(--font-ui);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
    border: 1px solid transparent;
    box-shadow: 0 4px 20px rgba(26,18,9,0.18);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: none;
}

.sm-toast--visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.sm-toast--success { background: #2d6a2d; color: #f5eedf; border-color: #1f4d1f; }
.sm-toast--error   { background: var(--burgundy); color: #f5eedf; border-color: var(--btn-primary-hover); }
.sm-toast--info    { background: var(--ink); color: var(--parchment); border-color: var(--rule-heavy); }


/* ============================================================
   SCHEMA FLASH-ANIMATIE
   ============================================================ */
@keyframes scheduleFlash {
    0%   { box-shadow: 0 0 0 0 rgba(154,117,48,0); }
    30%  { box-shadow: 0 0 0 6px rgba(154,117,48,0.4); }
    100% { box-shadow: 0 0 0 0 rgba(154,117,48,0); }
}

.schedule-flash {
    animation: scheduleFlash 0.8s ease-out forwards;
    border-radius: 2px;
}


/* ============================================================
   SCORETABEL — MOBIELE WEERGAVE
   ============================================================ */
@media (max-width: 640px) {
    #resultsDiagram table { display: none; }

    .scoretabel-mobiel {
        display: flex;
        flex-direction: column;
        gap: 0.4rem;
    }

    .scoretabel-mobiel-rij {
        display: flex;
        align-items: center;
        gap: 0.6rem;
        background: var(--parchment-mid);
        border: 1px solid var(--rule);
        border-left: 3px solid var(--gold);
        padding: 0.5rem 0.8rem;
    }

    .scoretabel-mobiel-rij .sm-stand {
        font-family: var(--font-ui);
        font-size: 0.9rem;
        font-weight: 700;
        color: var(--gold);
        min-width: 24px;
        text-align: center;
    }

    .scoretabel-mobiel-rij .sm-naam {
        flex: 1;
        font-family: var(--font-body);
        font-size: 0.9rem;
        font-weight: 700;
        color: var(--ink);
    }

    .scoretabel-mobiel-rij .sm-punten {
        font-family: var(--font-ui);
        font-size: 0.9rem;
        font-weight: 700;
        color: var(--burgundy);
        min-width: 40px;
        text-align: right;
    }
}

@media (min-width: 641px) {
    .scoretabel-mobiel { display: none; }
}


/* ============================================================
   BEVESTIGINGSDIALOOG & BEWERKINGSDIALOOG
   ============================================================ */
.sm-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 18, 9, 0.65);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.sm-confirm-box {
    background: var(--parchment);
    border: 3px double var(--rule-heavy);
    padding: 2rem 2.5rem;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.edit-player-box { max-width: 480px; }

.sm-confirm-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--burgundy);
    margin-bottom: 0.75rem;
}

.sm-confirm-msg {
    font-family: var(--font-body);
    font-size: 0.88rem;
    color: var(--ink-mid);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    font-style: italic;
}

.sm-confirm-btns {
    display: flex;
    gap: 0.6rem;
    justify-content: flex-end;
    margin-top: 1.25rem;
}

.sm-confirm-cancel,
.sm-confirm-ok {
    font-family: var(--font-ui);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 0.55rem 1.4rem;
    border: 1px solid;
    border-radius: 0;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.sm-confirm-cancel {
    background: none;
    color: var(--ink-mid);
    border-color: var(--rule-heavy);
}

.sm-confirm-cancel:hover { background: var(--parchment-dark); }

.sm-confirm-ok {
    background: var(--burgundy);
    color: var(--parchment);
    border-color: var(--burgundy);
}

.sm-confirm-ok:hover {
    background: var(--btn-primary-hover);
    border-color: var(--btn-primary-hover);
}
