/* ==========================================================================
   GLOBALE STILE
   ========================================================================== */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #111318;
    color: #ffffff;
    font-size: 12px;
}

/* Header */
.header {
    padding: 14px 20px;
    background: #181b22;
    border-bottom: 1px solid #2b2f38;
}

.header h1 {
    margin: 0;
    font-size: 22px;
}

.header p {
    margin: 2px 0 0;
    font-size: 12px;
    color: #8e96a3;
}

/* Main Container */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* ==========================================================================
   SERVER GRID (Repariertes Flex-Spalten-Layout: 100% unabhängiges Aufklappen)
   ========================================================================== */
.server-grid {
    display: flex;
    flex-direction: row; /* Stellt die 3 Hauptspalten nebeneinander */
    gap: 16px;
    width: 100%;
    align-items: flex-start;
}

/* Die 3 Spaltenbehälter selbst (Teilen sich den Platz mathematisch exakt auf) */
.server-column {
    flex: 1;
    display: flex;
    flex-direction: column; /* Karten innerhalb der Spalte stehen untereinander */
    gap: 16px;              /* Abstand zwischen den Karten untereinander */
    min-width: 0;           /* Erlaubt inneren Texten das sichere Kürzen mit '...' */
}

/* Responsive Anpassung für kleinere Bildschirme */
@media (max-width: 1200px) {
    /* Blendet die dritte Spalte im HTML via CSS/JS aus oder bricht hier um */
    .server-grid {
        flex-wrap: wrap;
    }
}

/* ==========================================================================
   SERVER CARD (Für den vertikalen Spaltenfluss optimiert)
   ========================================================================== */
.server-card {
    width: 100%;
    background: #1b1e25;
    border: 1px solid #2b2f38;
    border-radius: 8px;
    padding: 10px;        /* Ultra-kompakt im geschlossenen Zustand */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 6px; 
    min-height: auto; 
    transition: all 0.2s ease-in-out;
}

.server-card.expanded {
    gap: 12px;
    padding: 14px;
        /* Setzt einen 3px breiten, durchgezogenen Rahmen in deiner Akzentfarbe */
    border: 2px solid #35d07f !important;
    
    /* Optional: Ein dezenter grüner Schatten, um den Tiefen-Effekt zu verstärken */
    box-shadow: 0 6px 16px rgba(53, 208, 127, 0.15);
}


/* Kopfbereich als Klickfläche definieren */
.server-meta-section {
    cursor: pointer;
    user-select: none;
    padding: 2px;
    border-radius: 4px;
    transition: background 0.15s ease;
    width: 100%;
}

.server-meta-section:hover {
    background: rgba(255, 255, 255, 0.03);
}

.server-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
    width: 100%;
}

.server-header h2 {
    margin: 0;
    font-size: 14px;
    font-weight: bold;
    color: #fff;
}

.server-id {
    color: #737b88;
    font-size: 10px;
}

/* Indikator-Pfeil im Header */
.server-header::after {
    content: '▼';
    font-size: 9px;
    color: #737b88;
    transition: transform 0.2s ease;
    margin-left: 8px;
}

.server-card.expanded .server-header::after {
    transform: rotate(180deg);
    color: #35d07f;
}

/* ULTRA-KOMPAKTE STATUS-ZEILEN */
.status-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
}

.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 6px; 
    background: #14171c;
    border-radius: 4px;
}

.status-row span:first-child,
.status {
    font-size: 10px; 
}

.status {
    font-weight: bold;
}

.online {
    color: #35d07f;
}

.offline {
    color: #ff5c5c;
}
/* ==========================================================================
   SICHTBARKEITS-STEUERUNG (Kein Leerraum, Session-Info bleibt immer flach)
   ========================================================================== */
.session-live-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px;
    border-radius: 4px;
    border: 1px solid #232730;
    width: 100%;
}

.session-live-info div {
    display: flex;
    flex-direction: column;
    min-width: 0; /* Wichtig für die Textkürzung */
}

.session-live-info small {
    color: #737b88;
    font-size: 9px;
    text-transform: uppercase;
    margin-bottom: 1px;
}

/* REPARATUR-SCHUTZ: Text kürzt sich bei Überlänge automatisch mit '...', 
   damit die Cards sich niemals unkontrolliert verschieben! */
.session-live-info span {
    font-weight: bold;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* Blendet Details im Standard vollständig aus (0px Raumbelegung) */
.server-path,
.server-drivers-box,
.server-controls {
    display: none; 
    opacity: 0;
}

/* Aktivierte Zustände bei aufgeklappter Karte */
.server-card.expanded .server-path,
.server-card.expanded .server-drivers-box {
    display: flex;
    opacity: 1;
}

.server-card.expanded .server-controls {
    display: flex;
    opacity: 1;
    border-top: 1px dashed #2b2f38;
    padding-top: 10px;
    margin-top: 4px;
}

.server-telemetry-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.server-path {
    flex-direction: column;
    gap: 2px;
}

.server-path code {
    overflow-wrap: anywhere;
    padding: 4px;
    background: #111318;
    border-radius: 4px;
    color: #8e96a3;
    font-size: 10px;
    display: block;
}

.server-drivers-box {
    flex-direction: column;
    gap: 4px;
    background: #14171c;
    padding: 6px;
    border-radius: 4px;
    border: 1px solid #232730;
}

.server-drivers-box > span {
    font-size: 10px;
    color: #737b88;
    font-weight: bold;
    text-transform: uppercase;
    border-bottom: 1px solid #232730;
    padding-bottom: 2px;
}

.drivers-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 100px;
    overflow-y: auto;
}

.driver-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1b1e25;
    padding: 5px 8px;
    border-radius: 4px;
}

/* ==========================================================================
   KORREKTUR: Erzwingt Name, Auto und GUID in einer einzigen Zeile
   ========================================================================== */
.driver-info-box {
    display: flex !important;
    flex-direction: row !important; /* Verhindert das Untereinanderstehen */
    align-items: center !important;
    gap: 6px !important;
    min-width: 0;
    flex-grow: 1;
    overflow: hidden;
    white-space: nowrap;
}

.driver-header-line {
    display: flex !important;
    flex-direction: row !important; /* Garantiert Reihen-Layout */
    align-items: center !important;
    min-width: 0;
    overflow: hidden;
}


.driver-name {
    font-size: 11px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
}

.car-badge {
    background: #2b2f38;
    color: #8e96a3;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 9px;
    margin-left: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.driver-sub-info {
    font-size: 9px;
    color: #535d6c;
    margin-top: 1px;
}

.driver-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.driver-actions button {
    border: none;
    padding: 3px 6px;
    font-size: 9px;
    font-weight: bold;
    border-radius: 3px;
    cursor: pointer;
    transition: opacity 0.1s;
}

.driver-actions button:hover {
    opacity: 0.8;
}

.btn-kick {
    background: #ffaa5c;
    color: #111;
}

.btn-ban {
    background: #ff5c5c;
    color: #fff;
}

.no-drivers-text {
    font-size: 11px;
    color: #535d6c;
    text-align: center;
    font-style: italic;
    padding: 8px 0;
}

.server-log-box {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.server-log-box > span {
    font-size: 10px;
    color: #737b88;
    font-weight: bold;
    text-transform: uppercase;
}

.log-terminal {
    width: 100%;
    height: 110px; 
    background: #0d0f13;
    border: 1px solid #232730;
    border-radius: 4px 4px 0 0;
    padding: 6px;
    margin: 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 10px;
    color: #35d07f;
    overflow-y: auto;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

.chat-input-group {
    display: flex;
    width: 100%;
    background: #14171c;
    border: 1px solid #232730;
    border-top: none;
    border-radius: 0 0 4px 4px;
    padding: 4px;
}

.chat-input-group input {
    flex-grow: 1;
    background: #0d0f13;
    border: 1px solid #232730;
    border-radius: 3px;
    color: #fff;
    padding: 5px 8px;
    font-size: 11px;
    outline: none;
    min-width: 0;
}

.chat-input-group input:focus {
    border-color: #35d07f;
}

.chat-input-group button {
    background: #35d07f;
    color: #0d0f13;
    border: none;
    border-radius: 3px;
    padding: 0 12px;
    margin-left: 4px;
    font-weight: bold;
    font-size: 11px;
    cursor: pointer;
    transition: opacity 0.1s;
    flex-shrink: 0;
}

.chat-input-group button:hover {
    opacity: 0.9;
}

.log-terminal::-webkit-scrollbar,
.drivers-list::-webkit-scrollbar {
    width: 4px;
}
.log-terminal::-webkit-scrollbar-track,
.drivers-list::-webkit-scrollbar-track {
    background: #0d0f13;
}
.log-terminal::-webkit-scrollbar-thumb,
.drivers-list::-webkit-scrollbar-thumb {
    background: #2b2f38;
    border-radius: 2px;
}

.no-servers {
    padding: 30px;
    text-align: center;
    background: #1b1e25;
    border: 1px solid #2b2f38;
    border-radius: 6px;
}
/* ==========================================================================
   VISUELLER FEINSCHLIFF: GRÜNER RAHMEN FÜR AKTIVE SPRACH-BUTTONS
   ========================================================================== */
.language-picker button.active-lang {
    /* Setzt exakt denselben 3px grünen Rahmen wie bei den aufgeklappten Karten */
    border: 2px solid #35d07f !important;
    color: #35d07f !important;
    font-weight: bold;
    background: #14171c !important; /* Etwas dunklerer Hintergrund für Kontrast */
}
/* ==========================================================================
   VISUELLER FEINSCHLIFF: ZWEIZEILIGE FAHRERZEILE MIT AUSWAHL-RAHMEN
   ========================================================================== */
.driver-row-container {
    display: flex;
    flex-direction: column;
    background: #1b1e25;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid #232730;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    width: 100%;
}

.driver-row-container:hover {
    background: #232730;
}

/* Der feine grüne Auswahlrahmen (1px solid) bei Klick auf die Zeile */
.driver-row-container.selected-driver {
    border: 1px solid #35d07f !important;
    box-shadow: 0 0 6px rgba(53, 208, 127, 0.2);
    background: rgba(53, 208, 127, 0.03);
}


/* ==========================================================================
   REGELVERWALTUNG UND ZUSÄTZLICHE LIVE-KONSOLEN
   Ergänzungen: bestehende Klassen und Card-Layout bleiben unverändert.
   ========================================================================== */
.server-rules-section {
    margin-top: 8px;
    padding: 7px;
    border: 1px solid #232730;
    border-radius: 4px;
    background: rgba(13, 15, 19, 0.45);
    min-width: 0;
}

.server-rules-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 11px;
    min-width: 0;
}

.server-rules-header strong {
    flex: 0 0 auto;
    color: #ffffff;
}

.server-rules-count {
    flex: 1 1 auto;
    min-width: 0;
    color: #8e96a3;
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.server-rules-header button,
.server-rule-row button {
    flex: 0 0 auto;
    border: 1px solid #343a45;
    border-radius: 3px;
    padding: 4px 7px;
    background: #2b2f38;
    color: #ffffff;
    font: inherit;
    font-size: 10px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.server-rules-header button {
    background: #35d07f;
    border-color: #35d07f;
    color: #0d0f13;
    font-weight: bold;
    white-space: nowrap;
}

.server-rules-header button:hover {
    background: #52e596;
    border-color: #52e596;
}

.server-rules-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

/* Jede Regel bleibt als eigene, einzeilige Zeile dargestellt. */
.server-rule-row {
    display: flex;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 5px;
    width: 100%;
    min-width: 0;
    padding: 5px 6px;
    background: #15181e;
    border: 1px solid #232730;
    border-radius: 4px;
    font-size: 10px;
}

.server-rule-row input[type="checkbox"] {
    flex: 0 0 auto;
    margin: 0 2px 0 0;
    accent-color: #35d07f;
    cursor: pointer;
}

.server-rule-name {
    flex: 1 1 auto;
    min-width: 0;
    color: #ffffff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.server-rule-state {
    flex: 0 0 auto;
    color: #8e96a3;
    font-size: 9px;
    white-space: nowrap;
}

.server-rule-row button {
    padding: 3px 5px;
    white-space: nowrap;
}

.server-rule-row button:hover {
    border-color: #35d07f;
    color: #35d07f;
}

.server-rule-row button:last-child:hover {
    border-color: #ff5c5c;
    color: #ff5c5c;
}

.rules-empty {
    display: none; /* Leerer Zustand steht einzeilig im Kopf neben „Regeln“. */
}

.live-log-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
    margin: 7px 0;
}

.live-log-panel {
    min-width: 0;
    overflow: hidden;
    border: 1px solid #2b2f38;
    border-radius: 4px;
    background: #0d0f13;
}

.live-log-panel summary {
    cursor: pointer;
    padding: 6px 8px;
    color: #d5d9e0;
    font-size: 11px;
    list-style-position: inside;
}

.live-log-panel summary:hover {
    background: #181b22;
    color: #35d07f;
}

.live-log-preview {
    display: block;
    margin: 4px 0 0 16px;
    color: #737b88;
    font: 10px/1.4 "Courier New", Courier, monospace;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.live-log-panel:not([open]) .live-log-preview {
    max-height: 2.8em;
    overflow: hidden;
}

.live-log-terminal {
    width: 100%;
    height: auto;
    min-height: 55px;
    max-height: 220px;
    margin: 0;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

@media (max-width: 420px) {
    .server-rule-row { gap: 3px; padding: 4px; }
    .server-rule-row button { padding: 3px 4px; font-size: 9px; }
    .server-rule-state { display: none; }
}


/* Regel erstellen/bearbeiten Modal */
        .rule-modal-overlay { display:none; position:fixed; z-index:1001; inset:0; padding:18px; box-sizing:border-box; background:rgba(0,0,0,.72); align-items:center; justify-content:center; overflow-y:auto; }
        .rule-modal-card { width:min(560px, 100%); max-height:calc(100vh - 36px); overflow-y:auto; box-sizing:border-box; background:#1b1e25; border:1px solid #35d07f; padding:16px; border-radius:8px; box-shadow:0 4px 20px rgba(0,0,0,.5); color:#e7eaf0; }
        .rule-modal-card h3 { margin:0 0 14px; font-size:14px; }
        .rule-modal-card label { display:block; margin-bottom:5px; color:#cbd0d9; font-size:11px; }
        .rule-modal-card > label { margin-top:3px; }
        .rule-modal-control { display:block; width:100%; min-width:0; box-sizing:border-box; margin:0; padding:8px; background:#0d0f13; border:1px solid #343945; color:#fff; border-radius:4px; font-size:11px; }
        .rule-modal-control:focus { outline:1px solid #35d07f; border-color:#35d07f; }
        #rule-modal-name { margin-bottom:12px; }
        .rule-modal-field { min-width:0; }
        .rule-modal-field > label { margin:0 0 5px; }
        .rule-modal-card > .rule-modal-field { margin-bottom:10px; }
        .rule-modal-class-row { display:grid; grid-template-columns:minmax(0,1fr) auto auto; gap:6px; align-items:center; }
        .rule-modal-card button { cursor:pointer; padding:7px 9px; border:1px solid #343945; border-radius:4px; background:#2b2f38; color:#f3f4f6; font-size:10px; white-space:nowrap; }
        .rule-modal-card button:hover { border-color:#35d07f; color:#35d07f; }
        .rule-modal-grid { display:grid; gap:9px; align-items:end; margin:12px 0; }
        .rule-modal-time-row { grid-template-columns:repeat(3,minmax(0,1fr)); }
        .rule-modal-accident-row { grid-template-columns:repeat(3,minmax(0,1fr)); }
        .rule-modal-check { display:flex !important; align-items:center; gap:6px; min-height:33px; margin:0 !important; white-space:nowrap; }
        .rule-modal-check input { margin:0; accent-color:#35d07f; }
        .rule-modal-actions { display:flex; justify-content:flex-end; gap:7px; margin-top:16px; }
        .rule-modal-card .rule-modal-save { background:#35d07f; border-color:#35d07f; color:#0d0f13; font-weight:700; }
        @media (max-width:480px) {
            .rule-modal-card { padding:12px; }
            .rule-modal-class-row { grid-template-columns:minmax(0,1fr) auto; }
            .rule-modal-class-row select { grid-column:1 / -1; }
            .rule-modal-accident-row { grid-template-columns:1fr; }
        }

/* Regelaktivierung: gruen = aktiv, rot = inaktiv. */
.server-rule-row button.server-rule-toggle { border: 1px solid transparent; font-weight: 700; min-width: 58px; color: #fff; }
.server-rule-row button.server-rule-toggle.is-active { background: #167a43; border-color: #35d07f; }
.server-rule-row button.server-rule-toggle.is-inactive { background: #992b35; border-color: #ff7474; }
.server-rule-row button.server-rule-toggle:hover { color: #fff; filter: brightness(1.16); }

/* Unified ban dialog. No inline styling in HTML. */
.ban-modal-overlay { z-index: 2500; }
.ban-modal-card { width: min(94vw, 510px); max-height: 90vh; overflow-y: auto; padding: 24px; border-radius: 12px; background: #202631; color: #f5f5f5; box-shadow: 0 20px 60px #0009; display: flex; flex-direction: column; gap: 13px; }
.ban-modal-card h2 { margin: 0; font-size: 1.3rem; }
.ban-modal-card .rule-modal-field { display: flex; flex-direction: column; gap: 6px; }
.ban-modal-card input:not([type=checkbox]), .ban-modal-card textarea, .ban-modal-card select { width: 100%; box-sizing: border-box; padding: 10px; border-radius: 6px; background: #131923; border: 1px solid #687184; color: #fff; font: inherit; }
.ban-modal-card textarea { resize: vertical; min-height: 82px; }
.ban-modal-card label { font-weight: 600; }
.ban-modal-notify { display: flex; gap: 9px; align-items: flex-start; }
.ban-modal-server-list { display: flex; flex-wrap: wrap; gap: 8px 18px; max-height: 140px; overflow-y: auto; }
.ban-modal-server-list label { white-space: nowrap; }
.ban-modal-card fieldset { border: 1px solid #687184; border-radius: 6px; }
.ban-modal-card [hidden] { display: none !important; }
.ban-modal-error { color: #ff9b9b; min-height: 1.1em; margin: 0; }
.ban-modal-submit { background: #a3313a; color: white; border-radius: 6px; padding: 9px 16px; }
.ban-modal-submit:disabled { opacity: .5; cursor: wait; }

/* Ban dialog redesign: matches the dark RaceManager dashboard. */
.ban-modal-overlay { z-index: 2500; padding: 20px; background: rgba(3, 7, 13, .78); backdrop-filter: blur(5px); }
.ban-modal-card { width: min(100%, 640px); max-height: min(92vh, 850px); padding: 0; gap: 0; overflow-y: auto; background: #171d26; border: 1px solid #394552; border-radius: 16px; color: #f0f4f7; box-shadow: 0 28px 90px rgba(0,0,0,.65); }
.ban-modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 24px 26px 20px; border-bottom: 1px solid #303a46; }
.ban-modal-heading { min-width: 0; }
.ban-modal-eyebrow { display: block; margin-bottom: 7px; font-size: 10px; font-weight: 800; letter-spacing: .14em; color: #8fa5b8; }
.ban-modal-card h2 { margin: 0; font-size: 23px; line-height: 1.25; font-weight: 750; }
.ban-modal-subtitle { margin: 7px 0 0; color: #aab8c8; font-size: 12px; }
.ban-modal-card .ban-modal-close { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; border: 1px solid #394654; border-radius: 9px; background: #252f3a; color: #c8d3dd; font-size: 24px; line-height: 1; cursor: pointer; }
.ban-modal-card .ban-modal-close:hover { background: #344251; color: #fff; }
.ban-modal-body { display: flex; flex-direction: column; gap: 19px; padding: 22px 26px 16px; }
.ban-modal-driver-block { display: flex; flex-direction: column; gap: 5px; padding: 12px 15px; border: 1px solid #364453; border-left: 3px solid #e45d65; border-radius: 9px; background: #222b35; }
.ban-modal-driver-caption { color: #9eacba; font-size: 10px; font-weight: 800; letter-spacing: .12em; }
#ban-modal-driver { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.ban-modal-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ban-modal-card .ban-modal-field label { margin: 0; color: #e4eaf0; font-size: 12px; font-weight: 700; }
.ban-modal-card input:not([type=checkbox]), .ban-modal-card textarea, .ban-modal-card select { width: 100%; min-height: 43px; padding: 11px 13px; border: 1px solid #49586a; border-radius: 9px; background: #101720; color: #f5f7fa; font-size: 13px; line-height: 1.45; outline: none; transition: border-color .15s, box-shadow .15s; }
.ban-modal-card textarea { min-height: 94px; resize: vertical; }
.ban-modal-card input:not([type=checkbox]):focus, .ban-modal-card textarea:focus, .ban-modal-card select:focus { border-color: #51c990; box-shadow: 0 0 0 3px rgba(81,201,144,.14); }
.ban-modal-card input::placeholder, .ban-modal-card textarea::placeholder { color: #8191a3; }
.ban-modal-hint { color: #9eafc0; font-size: 11px; line-height: 1.5; }
.ban-modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ban-modal-extra-servers { margin: -3px 0 0; padding: 13px; border: 1px solid #455264; border-radius: 10px; }
.ban-modal-extra-servers legend { padding: 0 7px; font-size: 12px; color: #d7e1ea; }
.ban-modal-server-list { gap: 10px 18px; max-height: 125px; }
.ban-modal-server-list label { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.ban-modal-card input[type=checkbox] { width: 16px; height: 16px; flex: 0 0 16px; margin: 0; accent-color: #50c98d; }
.ban-modal-notify { display: flex; gap: 12px; align-items: flex-start; padding: 14px 15px; border: 1px solid #394858; border-radius: 10px; background: #222c37; cursor: pointer; }
.ban-modal-notify input { margin-top: 2px !important; }
.ban-modal-notify span { display: flex; flex-direction: column; gap: 4px; }
.ban-modal-notify strong { color: #e9eff5; font-size: 12px; font-weight: 700; }
.ban-modal-notify small { color: #aab9c8; font-size: 11px; line-height: 1.5; }
.ban-modal-error { min-height: 0; color: #ff9ca4; font-size: 12px; line-height: 1.4; }
.ban-modal-error:empty { display: none; }
.ban-modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 26px 22px; border-top: 1px solid #303a46; background: #1b232d; }
.ban-modal-card .ban-modal-footer button { min-height: 41px; padding: 10px 18px; border-radius: 9px; font-size: 12px; font-weight: 750; cursor: pointer; }
.ban-modal-cancel { background: #303c49; border: 1px solid #495b6d; color: #e4eaf0; }
.ban-modal-cancel:hover { background: #3c4b5c; }
.ban-modal-card .ban-modal-submit { background: #b93b46; border: 1px solid #d2535e; color: #fff; }
.ban-modal-card .ban-modal-submit:hover { background: #d04451; }
.ban-modal-submit:disabled { opacity: .55; cursor: wait; }
.ban-modal-card [hidden] { display: none !important; }
@media (max-width: 540px) {
  .ban-modal-overlay { padding: 10px; }
  .ban-modal-card { max-height: calc(100dvh - 20px); border-radius: 12px; }
  .ban-modal-header { padding: 19px 17px 15px; }
  .ban-modal-body { padding: 17px; gap: 16px; }
  .ban-modal-grid { grid-template-columns: 1fr; gap: 16px; }
  .ban-modal-footer { padding: 15px 17px; }
  .ban-modal-footer button { flex: 1; }
}


/* Final: ban dialog is a fully opaque surface, without an extra close X. */
#ban-modal.ban-modal-overlay { background: rgba(0, 0, 0, .84); }
#ban-modal .ban-modal-card {
    background-color: #19212b !important;
    background-image: none !important;
    opacity: 1 !important;
    backdrop-filter: none !important;
    isolation: isolate;
}
#ban-modal .ban-modal-header,
#ban-modal .ban-modal-body { background-color: #19212b; }
#ban-modal .ban-modal-footer { background-color: #222d39; }
#ban-modal #ban-modal-reason {
    display: block;
    height: 43px;
    min-height: 43px;
    max-height: 43px;
    resize: none;
}
/* Override shared button styles with specific activation states. */
.server-rules-list .server-rule-row button.server-rule-toggle.is-active {
    background: #167a43 !important;
    background-color: #167a43 !important;
    border: 1px solid #35d07f !important;
    color: #fff !important;
}
.server-rules-list .server-rule-row button.server-rule-toggle.is-inactive {
    background: #992b35 !important;
    background-color: #992b35 !important;
    border: 1px solid #ff7474 !important;
    color: #fff !important;
}

/* Opaque, scrollable ban management panel */
.ban-list-card { background: #171e2a !important; opacity: 1 !important; width: min(760px, 95vw); max-height: 90vh; overflow-y: auto; }
.ban-list-rows { display: grid; gap: 10px; max-height: 45vh; overflow-y: auto; }
.ban-list-row { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:12px; border:1px solid #354054; border-radius:10px; background:#202a39; }
.ban-list-info { display:grid; gap:4px; min-width:0; overflow-wrap:anywhere; }
.ban-list-info small { color:#a9b8ce; }
.ban-list-info span { color:#d3dbe6; font-size:0.9rem; }
.ban-list-actions { display:flex; gap:8px; flex-shrink:0; }
.ban-list-actions button, #ban-edit-form button { padding:9px 12px; border-radius:7px; cursor:pointer; }
.ban-list-remove { background:#a72d3b; color:#fff; border:1px solid #ce5967; }
#ban-edit-form { margin-top:16px; padding:16px; border:1px solid #45516a; border-radius:10px; background:#1d2736; }
#ban-edit-form[hidden], #ban-edit-servers-wrap[hidden] { display:none !important; }
#ban-edit-form input, #ban-edit-form select { width:100%; box-sizing:border-box; background:#111827; color:#fff; border:1px solid #526078; border-radius:7px; padding:10px; }
.ban-list-server-checks { display:flex; flex-wrap:wrap; gap:12px; }
.ban-list-server-checks input { width:auto !important; }
@media(max-width:600px) { .ban-list-row { align-items:stretch; flex-direction:column; } .ban-list-actions { justify-content:flex-end; } }

/* Modal visibility: JavaScript toggles rm-visible-flex. */
.rule-modal-overlay.rm-visible-flex { display:flex !important; }
#pm-modal { display:none; position:fixed; inset:0; z-index:1200; background:rgba(0,0,0,.78); align-items:center; justify-content:center; padding:18px; box-sizing:border-box; }
#pm-modal.rm-visible-flex { display:flex !important; }
#pm-modal > div { width:min(480px,100%); background:#1b1e25; color:#e7eaf0; border:1px solid #46566c; border-radius:12px; box-shadow:0 18px 60px rgba(0,0,0,.7); padding:22px; box-sizing:border-box; }
#pm-modal h3 { margin:0 0 12px; }
#pm-modal input[type=text] { display:block; width:100%; box-sizing:border-box; background:#111827; color:#fff; border:1px solid #526078; padding:10px; border-radius:8px; margin:12px 0; }
#pm-modal > div > div:last-child { display:flex; justify-content:flex-end; gap:10px; }
#pm-modal button { cursor:pointer; padding:9px 15px; border-radius:7px; }
#ban-list-modal { z-index:1150; }
#ban-list-modal .ban-list-card { width:min(760px,100%); max-height:calc(100vh - 36px); overflow-y:auto; }


/* Compact live driver cards and rule-check summaries. Scoped to dashboard cards. */
.server-card .server-drivers-box { min-width:0; }
.server-card .drivers-list { max-height:none; overflow:visible; gap:4px; }
.server-card .driver-row-container { box-sizing:border-box; padding:5px 7px; gap:3px; font-size:10px; }
.server-card .driver-main-line { display:flex; flex-wrap:nowrap; align-items:center; gap:7px; min-width:0; }
.server-card .driver-info-box { flex:1 1 auto; min-width:0; }
.server-card .driver-name { font-size:11px; }
.server-card .driver-actions { display:flex; flex:0 0 auto; gap:4px; }
.server-card .driver-actions button { padding:3px 6px; font-size:10px; line-height:1.2; }
.server-card .driver-sub-line { display:flex; flex-wrap:wrap; gap:3px 10px; align-items:center; font-size:10px; line-height:1.3; color:#aeb8c6; }
.server-card .driver-guid-line { font-size:9px; color:#8e96a3; }
.server-card .driver-qualification { display:grid; gap:2px; }
.server-card .qualification-line { font-size:10px; line-height:1.35; overflow-wrap:anywhere; }
.server-card .rule-events-section { margin-top:6px; padding:6px 7px; background:#14181f; border:1px solid #2b313d; border-radius:5px; min-width:0; }
.server-card .rule-events-section > strong { display:block; font-size:10px; margin-bottom:4px; }
.server-card .rule-events-list { display:grid; gap:3px; min-width:0; }
.server-card .rule-event-item { display:flex; flex-wrap:wrap; gap:3px 8px; padding:4px 6px; border:1px solid #2a313c; border-radius:4px; background:#1b2029; font-size:10px; line-height:1.3; overflow-wrap:anywhere; }
.server-card .rule-event-meta { color:#a8b6c8; font-size:10px; }
.server-card .rule-events-list .rules-empty { font-size:10px; color:#8e96a3; }
/* Kick form uses the same opaque modal language as the ban editor. */
#kick-modal { z-index:2400; background:rgba(0,0,0,.82); }
#kick-modal .kick-modal-card { width:min(430px,100%); display:grid; gap:9px; background:#19212e; color:#edf2fa; border:1px solid #46566c; border-radius:12px; box-shadow:0 18px 60px #000b; padding:20px; box-sizing:border-box; }
#kick-modal h3 { margin:0; font-size:17px; }
#kick-modal .kick-modal-driver { margin:0 0 4px; color:#b5c4d9; }
#kick-modal label { font-size:12px; font-weight:600; }
#kick-modal input { width:100%; box-sizing:border-box; background:#0d1420; border:1px solid #53647b; border-radius:6px; color:white; padding:10px; }
#kick-modal small { color:#aebbd0; line-height:1.45; }
#kick-modal-error { color:#ff8e95; min-height:14px; margin:0; font-size:11px; }
#kick-modal .kick-modal-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:5px; }
#kick-modal button { padding:9px 13px; border-radius:6px; border:1px solid #53647b; background:#283445; color:white; cursor:pointer; }
#kick-modal button[type=submit] { background:#a62d3a; border-color:#d35361; }
#kick-modal button:disabled { opacity:.55; cursor:wait; }

/* Fahrerprofile – Phase 1. Keine Auswirkungen auf bestehende Fahrerkarten. */
.ratings-profiles-overlay{display:none;position:fixed;inset:0;z-index:12000;background:rgba(0,0,0,.76);align-items:center;justify-content:center;padding:18px;box-sizing:border-box}
.ratings-profiles-overlay.is-open{display:flex}
.ratings-profiles-card{width:min(1050px,96vw);max-height:90vh;overflow:auto;background:#1b222d;color:#e8eef5;border:1px solid #405064;border-radius:12px;padding:18px;box-sizing:border-box;box-shadow:0 18px 70px #0009}
.ratings-profiles-head,.ratings-profiles-search{display:flex;gap:12px;align-items:center;justify-content:space-between}
.ratings-profiles-head h2{font-size:20px;margin:0}.ratings-profiles-card p{font-size:13px}
.ratings-profiles-search{justify-content:flex-start;margin:14px 0}.ratings-profiles-search input{min-width:220px;max-width:500px;flex:1}
.ratings-profiles-columns{display:grid;grid-template-columns:minmax(180px,270px) minmax(0,1fr);gap:16px;min-height:260px}
.ratings-profiles-list{max-height:56vh;overflow:auto;border:1px solid #354253;border-radius:8px;padding:6px}
.ratings-profile-item{display:flex;flex-direction:column;align-items:flex-start;gap:4px;width:100%;padding:10px;margin:0 0 5px;border:1px solid #394759;border-radius:7px;background:#273241;color:#f0f3f7;text-align:left;cursor:pointer}
.ratings-profile-item small{font-size:11px;opacity:.75}.ratings-profiles-detail{min-width:0;max-height:56vh;overflow:auto}
.ratings-profiles-detail h3{margin:0 0 6px}.ratings-profiles-table{width:100%;border-collapse:collapse;font-size:12px}
.ratings-profiles-table th,.ratings-profiles-table td{border-bottom:1px solid #394759;text-align:left;padding:7px 5px}
@media(max-width:700px){.ratings-profiles-columns{grid-template-columns:1fr}.ratings-profiles-list{max-height:160px}.ratings-profiles-detail{max-height:45vh}}

/* Sortierbare Fahrerprofil-Tabelle: kompakt, ohne Einfluss auf Fahrerkarten */
.ratings-sort-button{display:block;width:100%;padding:4px 2px;background:transparent;border:0;color:inherit;text-align:left;font:inherit;font-weight:600;cursor:pointer;white-space:nowrap}
.ratings-sort-button:hover{text-decoration:underline}
.ratings-method-note{font-size:11px!important;color:#aebfd1;line-height:1.45}
.ratings-profiles-table{min-width:690px}
.ratings-profiles-detail{overflow:auto}

/* Fahrerprofile: serverseitige Seiten zu je 20 Einträgen */
.ratings-profiles-list-column{min-width:0;display:flex;flex-direction:column;gap:8px}
.ratings-profiles-pager{display:flex;align-items:center;justify-content:space-between;gap:6px;font-size:12px}
.ratings-profiles-pager button{padding:5px 8px;font-size:12px;white-space:nowrap}
.ratings-profiles-pager button:disabled{opacity:.4;cursor:default}
.ratings-profiles-pager span{white-space:nowrap;font-variant-numeric:tabular-nums}

/* Rangliste und Mehrfachauswahl, nur im Fahrerprofile-Popup */
.ratings-compare-toolbar{display:flex;align-items:center;gap:9px;flex-wrap:wrap;font-size:12px;margin:4px 0 12px}
.ratings-compare-toolbar span{margin-right:auto;color:#b7c8db}
.ratings-compare-toolbar button{font-size:12px;padding:5px 9px}
.ratings-profile-select-row{display:flex;align-items:center;gap:8px}
.ratings-profile-select-row>input{flex:none;width:17px;height:17px;cursor:pointer}
.ratings-profile-select-row>.ratings-profile-item{flex:1;min-width:0}
.ratings-compare-table td{vertical-align:top;min-width:130px}
.ratings-compare-table td div{white-space:nowrap;margin-bottom:4px}

/* Desktop: breite Fahrerprofil-Ansicht fuer fuenf Vergleichsspalten.
   Nur dieses Modal wird angepasst; Fahrerkarten und Regelpruefungen bleiben unveraendert. */
@media (min-width: 1100px) {
  #ratings-profiles-modal.ratings-profiles-overlay { padding: 16px 24px; }
  #ratings-profiles-modal .ratings-profiles-card {
    width: min(1740px, 98vw);
    max-width: none;
    max-height: 94vh;
    padding: 20px 24px;
  }
  #ratings-profiles-modal .ratings-profiles-columns {
    grid-template-columns: minmax(210px, 245px) minmax(0, 1fr);
    gap: 18px;
  }
  #ratings-profiles-modal .ratings-profiles-detail { max-height: 72vh; }
  #ratings-profiles-modal .ratings-profiles-list { max-height: 69vh; }
  #ratings-profiles-modal .ratings-compare-table { width: 100%; min-width: 0; table-layout: fixed; font-size: 11px; }
  #ratings-profiles-modal .ratings-compare-table th,
  #ratings-profiles-modal .ratings-compare-table td {
    min-width: 0;
    overflow-wrap: anywhere;
    padding: 7px 6px;
  }
  #ratings-profiles-modal .ratings-compare-table th:nth-child(1),
  #ratings-profiles-modal .ratings-compare-table td:nth-child(1) { width: 13%; }
  #ratings-profiles-modal .ratings-compare-table th:nth-child(2),
  #ratings-profiles-modal .ratings-compare-table td:nth-child(2) { width: 12%; }
  #ratings-profiles-modal .ratings-compare-table td div { white-space: normal; }
}

/* Period controls in the driver profiles modal */
.rm-period-controls{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:8px 0}
.rm-period-controls select,.rm-period-controls button{max-width:100%;padding:6px 9px}
#rm-rating-period-status{font-size:12px;overflow-wrap:anywhere}

/* Server-Card: drei voneinander unabhängige, gut erkennbare Klappbereiche. */
.server-card .rm-card-fold { display:none; min-width:0; border:1px solid #303947; border-radius:6px; background:#14181f; overflow:hidden; }
.server-card.expanded .rm-card-fold { display:block; }
.server-card .rm-fold-title { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:9px 10px; cursor:pointer; color:#dce6f2; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.03em; list-style:none; user-select:none; }
.server-card .rm-fold-title::-webkit-details-marker { display:none; }
.server-card .rm-fold-title:hover { background:#222b35; }
.server-card .rm-fold-title:focus-visible { outline:2px solid #35d07f; outline-offset:-2px; }
.server-card .rm-fold-chevron { display:inline-block; flex:0 0 auto; width:8px; height:8px; border-right:2px solid #35d07f; border-bottom:2px solid #35d07f; transform:rotate(45deg); transition:transform .15s ease; margin-right:4px; }
.server-card .rm-card-fold[open] > .rm-fold-title .rm-fold-chevron { transform:rotate(225deg); }
.server-card .rm-card-fold[open] > .rm-fold-title { border-bottom:1px solid #303947; }
/* Die bisherigen Inhalte bleiben erhalten, sind aber nur innerhalb geöffneter Details sichtbar. */
.server-card .rm-card-fold .server-rules-section { margin:0; border:0; border-radius:0; }
.server-card .rm-card-fold .server-drivers-box { display:flex; opacity:1; border:0; border-radius:0; }
.server-card .rm-card-fold .server-controls { display:flex; opacity:1; border:0; margin:0; padding:0; }
.server-card .rm-card-fold .server-log-box { padding:8px; }
.server-card .rm-card-fold .server-rules-header > strong { display:none; }
.server-card .rm-card-fold .server-drivers-box > span,
.server-card .rm-card-fold .server-log-box > span { display:none; }

/* Benutzerrollen und Benutzerverwaltung – alle CSS-Regeln bleiben in style.css */
.rm-logout-form{display:inline-flex;margin:0}.rm-logout-form button{cursor:pointer}
body[data-rm-role="user"] .driver-actions,
body[data-rm-role="user"] .server-rules-header button,
body[data-rm-role="user"] .server-rule-row button,
body[data-rm-role="user"] .chat-input-group,
body[data-rm-role="user"] #open-ban-list,
body[data-rm-role="user"] .rm-period-controls,
body[data-rm-role="moderator"] .rm-period-controls,
body[data-rm-role="moderator"] .server-rules-header button,
body[data-rm-role="moderator"] .rm-rule-edit,
body[data-rm-role="moderator"] .rm-rule-delete {display:none!important}
.rm-users-overlay[hidden]{display:none!important}.rm-users-overlay{position:fixed;inset:0;z-index:99999;background:#000b;display:flex;align-items:center;justify-content:center;padding:20px}
.rm-users-dialog{width:min(740px,96vw);max-height:92vh;overflow:auto;background:#20252f;color:#fff;border:1px solid #576174;border-radius:12px;padding:22px;font-size:14px}
.rm-users-dialog header{display:flex;justify-content:space-between;align-items:center}.rm-users-dialog header button{font-size:22px}
.rm-users-dialog label{display:block;margin:8px 0}.rm-users-dialog input:not([type=checkbox]),.rm-users-dialog select{display:block;width:100%;padding:9px;background:#151923;color:white;border:1px solid #64748b;border-radius:5px}
.rm-users-dialog fieldset{border:1px solid #475569}.rm-users-dialog #rm-u-servers{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr))}
.rm-users-dialog button{margin:4px;padding:7px 12px;cursor:pointer}.rm-user-row{display:flex;gap:8px;align-items:center;border-bottom:1px solid #475569;padding:6px 0}.rm-user-row span{flex:1;overflow-wrap:anywhere}#rm-u-error{color:#ff9d9d}

/* Anmeldung */
body:has(form[action="/login"]) {font:16px system-ui;background:#101722;color:#eee;display:grid;place-items:center;min-height:100vh;margin:0}
form[action="/login"] {background:#1d2939;padding:32px;border-radius:12px;width:min(340px,85vw)}
form[action="/login"] input,form[action="/login"] button{box-sizing:border-box;width:100%;padding:12px;margin:9px 0;border-radius:6px;border:1px solid #667}
form[action="/login"] button{background:#2685d4;color:white;cursor:pointer}
form[action="/login"] small{color:#fca5a5}

/* Read-only accounts: do not show server rules or live console/chat. */
body[data-rm-role="user"] .server-card .rm-rules-fold,
body[data-rm-role="user"] .server-card .rm-logs-fold {
    display: none !important;
}

/* Serverkarten: historische Bestzeiten nach aktiver Strecken-/Fahrzeugkombination */
.rm-leaderboard-content { padding: 10px; display: grid; gap: 12px; min-width: 0; }
.rm-lb-track { color: #b5c3d2; font-size: 12px; overflow-wrap: anywhere; }
.rm-lb-group { display: grid; gap: 7px; min-width: 0; }
.rm-lb-group > strong { font-size: 13px; }
.rm-lb-car { width: 100%; min-width: 0; border: 1px solid #3c4a5b; border-radius: 5px; background: #101720; color: #f0f3f7; padding: 7px; }
.rm-lb-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.rm-lb-table td { padding: 6px 4px; border-bottom: 1px solid #303947; overflow-wrap: anywhere; }
.rm-lb-table td:first-child { width: 25px; color: #aab8c7; }
.rm-lb-table td:last-child { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rm-lb-table td small { display: block; color: #aab8c7; font-size: 11px; }
.rm-lb-empty { color: #aab8c7; font-size: 12px; padding: 8px 0; }

/* Bestenlisten: zunächst Top 3, zusätzliche Plätze per Klick. */
.rm-lb-table tr[hidden], .rm-lb-group[hidden] { display: none !important; }
.rm-lb-more { margin-top: 8px; padding: 7px 11px; border: 1px solid #3c4a5b; border-radius: 5px; background: #182536; color: #e8eef5; cursor: pointer; font: inherit; font-size: 12px; }
.rm-lb-more:hover { background: #25374d; }

/* Kompakte Bestenlisten: Platz, Fahrer, Fahrzeug und Zeit in einer Zeile. */
.rm-leaderboard-content { padding: 7px; gap: 8px; }
.rm-lb-group { gap: 4px; }
.rm-lb-table { table-layout: fixed; font-size: 10px; line-height: 1.2; }
.rm-lb-table td { padding: 3px 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; overflow-wrap: normal; }
.rm-lb-table td:first-child { width: 19px; }
.rm-lb-table td:last-child { width: 72px; }
.rm-lb-table td small { display: inline; font-size: 9px; margin-left: 5px; white-space: nowrap; }
.rm-lb-table td small::before { content: "· "; }
.rm-lb-car { padding: 5px; font-size: 11px; }
.rm-lb-more { margin-top: 5px; padding: 5px 8px; font-size: 11px; }


/* Kompakter Kopf: Strecke/Slots, Wertungstitel und Fahrzeugauswahl in einer Zeile. */
.rm-lb-topline {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 7px;
    min-width: 0;
}
.rm-lb-topline .rm-lb-track {
    flex: 0 1 auto;
    min-width: 0;
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rm-lb-topline > strong {
    flex: 0 0 auto;
    font-size: 10px;
    white-space: nowrap;
}
.rm-lb-topline .rm-lb-car {
    flex: 1 1 90px;
    width: auto;
    min-width: 65px;
    max-width: 220px;
    padding: 3px 5px;
    font-size: 10px;
}

/* RaceManager context help: CSS only in style.css */
.rm-help-overlay[hidden]{display:none!important}
.rm-help-overlay{position:fixed;inset:0;z-index:20000;background:rgba(0,0,0,.7);display:flex;align-items:center;justify-content:center;padding:16px}
.rm-help-dialog{width:min(920px,100%);max-height:90vh;overflow:hidden;display:flex;flex-direction:column;background:#182333;color:#f3f6fc;border:1px solid #52627a;border-radius:12px;box-shadow:0 12px 45px #0008}
.rm-help-header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 18px;border-bottom:1px solid #42516a}
.rm-help-header h2{font-size:19px;margin:0}
.rm-help-header button,.rm-help-nav button{background:#26374b;color:#f3f6fc;border:1px solid #52627a;border-radius:6px;padding:7px 10px;cursor:pointer}
.rm-help-nav{display:flex;flex-wrap:wrap;gap:6px;padding:12px 16px;overflow-y:auto;max-height:35vh}
.rm-help-nav button{font-size:12px}
.rm-help-nav button.rm-help-active{background:#326a9d;border-color:#7fb3e4}
.rm-help-content{overflow-y:auto;padding:16px 20px 25px;line-height:1.65}
.rm-help-content h3{margin:0 0 8px;font-size:18px}
.rm-help-content p{margin:0;white-space:pre-line}
.rm-help-context{display:inline-flex;align-items:center;justify-content:center;margin-left:7px;min-width:22px;height:22px;border:1px solid #637e9c;border-radius:50%;background:#26374b;color:#fff;font-size:12px;cursor:pointer;vertical-align:middle;flex-shrink:0}
.rm-help-context:hover,.rm-help-header button:hover,.rm-help-nav button:hover{background:#37658b}
.rm-help-btn{white-space:nowrap}

/* Ausführliches, durchsuchbares RaceManager-Handbuch */
.rm-help-search-wrap{padding:12px 16px 0}
.rm-help-search-wrap input{width:100%;box-sizing:border-box;border:1px solid #52627a;border-radius:7px;background:#101c2b;color:#f3f6fc;padding:10px 12px;font-size:13px}
.rm-help-content h4{font-size:13px;color:#9ecbfa;margin:17px 0 5px}
.rm-help-content h3{font-size:19px;margin:0 0 12px}
.rm-help-content p{white-space:normal;margin:0 0 9px;font-size:13px}
.rm-help-content ol{margin:5px 0 14px;padding-left:25px}
.rm-help-content li{padding-left:4px;margin:5px 0;font-size:13px}
.rm-help-content{scroll-behavior:smooth}
.rm-help-nav{max-height:22vh}
@media(max-width:640px){.rm-help-dialog{max-height:94vh}.rm-help-nav{max-height:20vh}.rm-help-content{padding:12px}}

/* Fix: kompakte geschlossene Bereiche und kleine Kontexthilfe */
.server-card .rm-card-fold > summary.rm-fold-title {
    min-height: 0;
    padding: 5px 8px;
    gap: 5px;
    font-size: 10px;
    line-height: 1.2;
    letter-spacing: 0;
}
.server-card .rm-card-fold > summary .rm-help-context {
    width: 15px;
    min-width: 15px;
    height: 15px;
    margin-left: 4px;
    padding: 0;
    font-size: 10px;
    line-height: 1;
    border-width: 1px;
}
.server-card .rm-card-fold > summary .rm-fold-chevron {
    width: 6px;
    height: 6px;
    border-width: 1.5px;
    margin-right: 2px;
}
/* Benutzerverwaltung liegt bei z-index 99999: Hilfe muss darüber erscheinen. */
.rm-help-overlay { z-index: 110000; }

/* Leaderboard: help icon on the right, fold chevron at the far right. */
.server-card .rm-leaderboard-fold > summary.rm-fold-title { display:flex; align-items:center; }
.server-card .rm-leaderboard-fold > summary.rm-fold-title > .rm-help-context { margin-left:auto; margin-right:8px; flex:0 0 15px; }
.server-card .rm-leaderboard-fold > summary.rm-fold-title > .rm-fold-chevron { margin-left:0; margin-right:3px; flex-shrink:0; }

/* Gleiche Kopf-Anordnung für Bestenliste, Aktive Fahrer und Regeln. */
.server-card :is(.rm-leaderboard-fold,.rm-drivers-fold,.rm-rules-fold) > summary.rm-fold-title {display:flex;align-items:center;}
.server-card :is(.rm-leaderboard-fold,.rm-drivers-fold,.rm-rules-fold) > summary.rm-fold-title > .rm-help-context {margin-left:auto;margin-right:8px;flex:0 0 15px;order:1;}
.server-card :is(.rm-leaderboard-fold,.rm-drivers-fold,.rm-rules-fold) > summary.rm-fold-title > .rm-fold-chevron {margin-left:0;margin-right:3px;flex-shrink:0;order:2;}

/* Regelverwaltung: kompakte Karten, Filter und übersichtlicher Editor */
.rm-rule-filters{display:flex;gap:5px;flex-wrap:wrap;margin:7px 0}
.rm-rule-filter{border:1px solid #414b57;background:#1a2029;color:#dce3ea;border-radius:6px;padding:4px 10px;font-size:10px;cursor:pointer}
.rm-rule-filter.is-current{border-color:#35d07f;color:#35d07f;background:#173229}
.server-rule-row{display:flex;flex-wrap:wrap;align-items:center;gap:5px 8px;padding:8px 7px}
.server-rule-name{font-weight:700}
.rm-rule-row-details{flex-basis:100%;order:2;color:#aeb9c8;font-size:10px;line-height:1.45;overflow-wrap:anywhere}
.server-rule-row > button{font-size:10px}
.rm-rule-editor{width:min(690px,100%);max-height:min(92vh,880px);padding:15px 18px}
.rm-rule-editor-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}
.rm-rule-editor-head h3{margin:0}
.rm-rule-editor .rm-rule-close{font-size:20px;line-height:1;padding:0 8px}
.rm-rule-section{border:1px solid #323b47;border-radius:8px;padding:12px;margin:9px 0;background:#171c24}
.rm-rule-section h4,.rm-rule-summary-box h4{font-size:12px;color:#35d07f;margin:0 0 10px}
.rm-rule-section .rule-modal-field{margin:0 0 10px}
.rm-rule-race-section{border-top:1px solid #323b47;padding-top:12px;margin-top:13px}
#rm-rule-race-fields[hidden]{display:none!important}
.rm-rule-summary-box{border:1px solid #44604f;border-radius:8px;background:#14251d;padding:12px;margin-top:10px}
#rm-rule-summary{font-size:11px;line-height:1.7;overflow-wrap:anywhere}
.rm-rule-summary-box p{font-size:10px;color:#b3c3b8;margin:7px 0 0}
@media(max-width:650px){.rm-rule-editor{padding:10px}.rm-rule-section{padding:9px}.rule-modal-time-row{grid-template-columns:1fr 1fr}}

/* Regelübersicht: Name und Icon-Aktionen in Zeile 1, Beschreibung in Zeile 2 */
.server-rule-row{display:flex;flex-direction:column;align-items:stretch;gap:4px}
.rm-rule-row-main{display:flex;align-items:center;gap:7px;min-width:0;width:100%}
.rm-rule-row-main .server-rule-name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis}
.rm-rule-row-main .server-rule-state{flex:0 0 auto}
.rm-rule-row-buttons{display:flex;gap:4px;align-items:center;flex:0 0 auto;margin-left:auto}
.server-rule-row .rm-rule-row-buttons button{display:inline-flex;align-items:center;justify-content:center;width:25px;height:25px;min-width:25px;padding:0;font-size:15px;line-height:1;border-radius:5px}
.rm-rule-row-details{order:initial;flex-basis:auto;width:100%;padding-left:1px;font-size:10px;line-height:1.4}
.rm-rule-action-section{border-top:1px solid #323b47;margin-top:12px;padding-top:12px}
.rm-rule-action-section h4,.rm-rule-race-section h4{font-size:12px;color:#35d07f;margin:0 0 10px}
.rm-rule-action-note{font-size:10px;color:#aeb9c8;line-height:1.4}
@media(max-width:480px){.server-rule-row .rm-rule-row-buttons button{width:23px;min-width:23px;height:23px;font-size:14px}}

/* Eigenständige, fortlaufend nummerierte Abschnitte für Qualifikation, Lizenz und Rennen */
.rm-rule-qual-group.rm-hidden{display:none!important}
.rm-rule-qual-group.rm-visible-block{display:block!important}
.rm-rule-qual-group > .rm-rule-section{margin:9px 0}
.rm-rule-qual-group > .rm-rule-section > h4{margin-bottom:10px}

#rm-class-overlay{z-index:110010}
.rm-class-editor{width:min(600px,95vw)}
#rm-class-cars{display:flex;flex-direction:column;gap:5px;margin-top:6px;max-height:240px;overflow:auto}
.rm-class-car-row{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:5px 9px;border:1px solid #384352;border-radius:6px;font-size:11px;overflow-wrap:anywhere}
.rm-class-car-row span{min-width:0;flex:1}
.rm-class-car-row button{width:24px;min-width:24px;height:24px;padding:0}
.rm-class-add-row{display:grid;grid-template-columns:1fr 1fr auto;gap:6px;align-items:center}
@media(max-width:600px){.rm-class-add-row{grid-template-columns:1fr}.rm-class-add-row button{width:100%}}

/* Layout selection belongs to basic rule data. */
.rm-rule-editor #rule-modal-layout{width:100%;max-width:100%}

.rm-class-hint{font-size:10px;line-height:1.5;color:#b8c7d5;margin:7px 0}
#rm-class-choice option.rm-class-related{color:#28b877;font-weight:bold}
#rm-class-choice option.rm-class-similar{color:#e1ac48;font-weight:bold}

#rm-class-choice option.rm-class-related{color:#28b877;font-weight:700}
#rm-class-choice option.rm-class-similar{color:#d0a8ef;font-weight:700}

/* Lesende Regelsimulation: eigenes Fenster über dem Regeleditor */
#rm-rule-simulation{z-index:110020}
.rm-sim-card{width:min(760px,95vw)}
#rm-sim-subtitle{color:#aeb9c8;font-size:11px;margin:4px 0 0}
#rm-sim-body{max-height:65vh;overflow-y:auto;font-size:12px}
.rm-sim-counts{display:flex;flex-wrap:wrap;gap:8px;margin:10px 0 14px}
.rm-sim-counts span{padding:6px 9px;border:1px solid #3d4a56;border-radius:6px}
.rm-sim-driver{border-top:1px solid #3b4551;padding:9px 2px}
.rm-sim-driver-head{display:flex;gap:8px;justify-content:space-between;align-items:center;margin-bottom:4px}
.rm-sim-driver-head strong{overflow-wrap:anywhere}
.rm-sim-driver-head span{white-space:nowrap}
.rm-sim-passed{color:#35d07f}.rm-sim-failed{color:#f48d8d}.rm-sim-unknown{color:#e8bd68}
.rm-sim-driver>div:last-child{color:#afbdcb;font-size:11px;line-height:1.5}
.rm-sim-launch{margin-right:auto}

.rm-sim-tabs{display:flex;gap:7px;margin:12px 0 10px;flex-wrap:wrap}
.rm-sim-tabs button{border:1px solid #46505b;border-radius:7px;background:#202731;color:#d5dce5;padding:7px 12px;cursor:pointer;font-size:11px}
.rm-sim-tabs button.is-current{border-color:#36d17f;color:#36d17f;background:#173429;font-weight:700}

/* Klickbare Zusammenfassung der Regelsimulation */
.rm-sim-count-buttons{display:flex;gap:7px;flex-wrap:wrap;margin-bottom:8px}
.rm-sim-count-buttons .rm-sim-count-button{border:1px solid #48515f;border-radius:7px;background:#1c2430;color:#e4e9ef;padding:8px 10px;cursor:pointer;font-size:11px;white-space:normal;text-align:left}
.rm-sim-count-buttons .rm-sim-count-button:hover,.rm-sim-count-buttons .rm-sim-count-button:focus-visible{border-color:#42c987}
.rm-sim-count-buttons .rm-sim-count-button.is-current{background:#17372a;color:#62e6a5;border-color:#42c987;font-weight:700}
.rm-sim-filter-note{font-size:10px;color:#aeb9c8;margin:5px 0 9px}

.btn-pit-test{background:#24556a;color:#fff;border:1px solid #44829b;border-radius:5px;padding:5px 9px;cursor:pointer}.btn-pit-test:disabled{opacity:.5;cursor:wait}

.rm-csp-testbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:8px 0}.rm-csp-testbar button{border:1px solid #48809b;background:#21465d;color:white;padding:7px 10px;border-radius:6px;cursor:pointer}.rm-csp-testbar small{opacity:.75}
