.rally2-wrap {
    max-width: 900px;
    margin: 0 auto 40px;
    padding: 0;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 24px rgba(0,0,0,.18);
}

.rally2-header {
    background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
    color: #fff;
    padding: 20px 24px;
    border-bottom: 4px solid #c40000;
    text-align: center;
}
.rally2-header__title { margin: 0 0 6px; color: #fff; font-size: 1.4em; letter-spacing: 0.5px; }
.rally2-header__subtitle { margin: 0; color: #d8d8d8; font-size: 0.95em; }
.rally2-header__intro { padding: 12px 24px; background: #fafafa; }

.rally2-tab-panel { padding: 0 24px 24px; }

.rally2-countdown {
    background: #fff3cd;
    border-left: 4px solid #c40000;
    padding: 10px 16px;
    font-weight: 600;
    color: #6d4c00;
    display: flex;
    align-items: center;
    gap: 8px;
}
.rally2-countdown-icon { font-style: normal; }

.rally2-tabs { display: flex; border-bottom: 2px solid #1a1a1a; background: #1a1a1a; }
.rally2-tab {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    color: #bbb;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95em;
}
.rally2-tab.is-active { background: #c40000; color: #fff; }

.rally2-section {
    position: relative;
    border: none;
    padding: 14px 0;
    margin: 0;
    background: #fff;
    border-bottom: 1px solid #eee;
}
.rally2-section:last-of-type { border-bottom: none; }

/* Full-section overlay shown while a "Buscar" lookup for that section is
   in flight — blocks interaction with the whole section, not just the
   lookup row, so it's obvious the entire piloto/navegante/vehicle block
   is momentarily locked while the backend responds. */
.rally2-section-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    z-index: 5;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 6px;
}
.rally2-section-overlay.is-active { display: flex; }
.rally2-section-overlay-text { font-weight: 600; color: #c40000; font-size: 0.9em; }
.rally2-spinner {
    width: 34px;
    height: 34px;
    border: 4px solid #eee;
    border-top-color: #c40000;
    border-radius: 50%;
    animation: rally2-spin 0.7s linear infinite;
}
@keyframes rally2-spin { to { transform: rotate(360deg); } }
.rally2-section-title {
    font-weight: 700;
    font-size: 1em;
    margin: 0 0 10px;
    padding-left: 12px;
    border-left: 4px solid #c40000;
    line-height: 1.3;
    color: #444444;
}

/* Compact grid — several fields per row instead of one full-width field
   per row, matching v1's denser layout. Full-width exceptions (long text,
   textarea, dropzone) opt out via .rally2-row--full. */
.rally2-fields-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 8px 14px;
}
.rally2-row--full { grid-column: 1 / -1; }

.rally2-row { margin-bottom: 8px; display: flex; flex-direction: column; gap: 3px; }
.rally2-fields-grid .rally2-row { margin-bottom: 0; }
.rally2-row label { font-weight: 600; font-size: 0.78em; text-transform: uppercase; letter-spacing: 0.3px; color: #444; }
.rally2-row input[type="text"],
.rally2-row input[type="email"],
.rally2-row input[type="number"],
.rally2-row input[type="password"],
.rally2-row select,
.rally2-row textarea { padding: 7px 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 0.95em; }
.rally2-row .description { font-size: 0.78em; color: #777; text-transform: none; font-weight: 400; margin: 2px 0 0; }

.rally2-lookup-row { margin-bottom: 10px; }
.rally2-lookup-row label { font-weight: 600; font-size: 0.78em; text-transform: uppercase; letter-spacing: 0.3px; color: #444; display: block; margin-bottom: 3px; }
.rally2-lookup-input { display: flex; gap: 8px; }
.rally2-lookup-input input { flex: 1; padding: 7px 10px; border: 1px solid #ccc; border-radius: 6px; }
.rally2-lookup-status { display: block; font-size: 0.8em; color: #666; margin-top: 3px; min-height: 1.1em; }
.rally2-lookup-status.is-found { color: #1a7a3a; }
.rally2-lookup-status.is-not-found { color: #8a6414; }

.rally2-locked {
    background: #f2f2f2 !important;
    color: #888 !important;
    pointer-events: none;
}

.rally2-btn { padding: 10px 18px; border: none; border-radius: 6px; background: #eee; cursor: pointer; font-size: 0.95em; }
.rally2-btn--primary { background: #c40000; color: #fff; }
.rally2-btn--large { width: 100%; padding: 15px; font-size: 1.1em; margin-top: 8px; font-weight: 700; letter-spacing: 0.3px; }
.rally2-btn--large:disabled { opacity: 0.6; cursor: default; }

.rally2-notice { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; }
.rally2-notice--info { background: #eef6ff; border-left: 4px solid #2271b1; color: #0d3a63; }
.rally2-notice--error { background: #fbeaea; border-left: 4px solid #c40000; color: #7a1414; }
.rally2-error { color: #c40000; }
.rally2-disclaimer { font-size: 0.85em; color: #777; text-align: center; margin: 16px 0; }

.rally2-payment-info { background: #fff8e1; border-left: 4px solid #f0a500; padding: 12px 16px; border-radius: 4px; margin-bottom: 16px; font-size: 0.9em; color: #6d4c00; }
.rally2-payment-info p:first-child { margin-top: 0; }
.rally2-payment-info p:last-child { margin-bottom: 0; }

.rally2-dropzone {
    position: relative;
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 28px 16px;
    text-align: center;
    background: #fafafa;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.rally2-dropzone:hover, .rally2-dropzone.is-dragover { border-color: #c40000; background: #fff5f5; }
.rally2-dropzone-icon { font-size: 2em; margin-bottom: 6px; }
.rally2-dropzone-text { font-weight: 600; color: #444; }
.rally2-dropzone-hint { font-size: 0.8em; color: #888; margin-top: 4px; }
.rally2-dropzone-filename { font-size: 0.85em; color: #1a7a3a; margin-top: 8px; font-weight: 600; word-break: break-all; }
.rally2-dropzone input[type="file"] {
    position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer;
}

.rally2-signature-wrap { position: relative; }
#rally2-signature-pad {
    width: 100%;
    height: 320px;
    border: 1px solid #ccc;
    border-radius: 8px;
    touch-action: none;
    background: #fff;
    display: block;
}
.rally2-signature-hint {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: #bbb;
    font-size: 1.1em;
    pointer-events: none;
}
.rally2-signature-hint.is-hidden { display: none; }

.rally2-gate-box, .rally2-card, #rally2-form-success {
    max-width: 420px;
    margin: 40px auto;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 32px;
    text-align: center;
}
.rally2-tab-panel .rally2-card { max-width: 100%; margin: 24px 0; text-align: left; }

@media (max-width: 640px) {
    .rally2-wrap { padding: 0 8px; }
    #rally2-signature-pad { height: 220px; }
}
