:root {
    --lai-primary: #0f172a;
    /* Slate 900 */
    --lai-secondary: #be9b7b;
    /* Gold */
    --lai-bg: #ffffff;
    --lai-border: #cbd5e1;
    /* Slate 300 */
    --lai-text: #334155;
    /* Slate 700 */
    --lai-text-head: #0f172a;
    --lai-focus-ring: rgba(190, 155, 123, 0.25);
    --lai-font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#lai-legal-form-container {
    max-width: 650px;
    margin: 40px auto;
    padding: 30px;
    background: var(--lai-bg);
    border-radius: 16px;
    /* Soft card look */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    font-family: var(--lai-font);
    color: var(--lai-text);
    border: 1px solid #f1f5f9;
    box-sizing: border-box;
}

#lai-legal-form-container * {
    box-sizing: border-box;
}

/* Header */
.lai-header {
    margin-bottom: 25px;
    text-align: center;
}

.lai-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--lai-text-head);
    margin: 0 0 8px 0;
    line-height: 1.2;
}

.lai-header p {
    font-size: 1rem;
    color: #64748b;
    margin: 0;
}

/* Steps */
.lai-step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.lai-step {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.lai-step.active {
    background: var(--lai-primary);
    color: #fff;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--lai-primary);
}

.lai-line {
    flex: 0 0 60px;
    height: 2px;
    background: #e2e8f0;
    margin: 0 12px;
}

#lai-progress-text {
    text-align: center;
    color: #94a3b8;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Forms */
.lai-form-group {
    margin-bottom: 20px;
}

.lai-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--lai-text-head);
    font-size: 0.95rem;
}

.lai-form-group input[type="text"],
.lai-form-group input[type="email"],
.lai-form-group input[type="tel"],
.lai-form-group textarea,
.lai-form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--lai-border);
    border-radius: 10px;
    font-size: 1rem;
    line-height: 1.5;
    background: #f8fafc;
    transition: all 0.2s ease;
    color: #0f172a;
}

.lai-form-group input:focus,
.lai-form-group textarea:focus {
    outline: none;
    border-color: var(--lai-secondary);
    background: #fff;
    box-shadow: 0 0 0 4px var(--lai-focus-ring);
}

.lai-form-group textarea {
    resize: vertical;
    min-height: 120px;
}

/* Radio Buttons Custom */
.lai-radio-wrapper {
    display: flex;
    align-items: flex-start;
    /* Align top for long text */
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid var(--lai-border);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.lai-radio-wrapper:hover {
    background: #f8fafc;
}

.lai-radio-wrapper input[type="radio"] {
    margin-right: 12px;
    margin-top: 3px;
    /* Optional: custom radio style could go here */
}

.lai-radio-wrapper label {
    margin: 0;
    font-weight: 400;
    cursor: pointer;
    flex: 1;
    /* details expand */
}

/* Button */
.lai-btn-primary {
    display: block;
    width: 100%;
    padding: 16px 24px;
    background: var(--lai-primary);
    color: #fff;
    font-size: 1.05rem;
    font-weight: 600;
    text-align: center;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.1), 0 2px 4px -1px rgba(15, 23, 42, 0.06);
}

.lai-btn-primary:hover {
    background: #1e293b;
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(15, 23, 42, 0.15);
}

.lai-btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.lai-disclaimer {
    text-align: center;
    margin-top: 15px;
    font-size: 0.85rem;
    color: #94a3b8;
}

/* Loading */
#lai-loading {
    display: none;
    text-align: center;
    padding: 40px 0;
}

.lai-spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto 20px;
    border: 5px solid #e2e8f0;
    border-top-color: var(--lai-secondary);
    border-radius: 50%;
    animation: lai-spin 1s linear infinite;
}

@keyframes lai-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Messages and Solutions */
.lai-solution-message {
    padding: 16px;
    background: #f0fdf4;
    /* green-50 */
    border: 1px solid #bbf7d0;
    /* green-200 */
    border-radius: 8px;
    color: #166534;
    /* green-800 */
    font-size: 0.95rem;
    line-height: 1.5;
}

.lai-info {
    color: var(--lai-text);
    padding: 10px;
    background: #f1f5f9;
    border-radius: 6px;
    text-align: center;
}

.lai-warning {
    color: #b45309;
    background: #fffbeb;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #fde68a;
    text-align: center;
}

.lai-success {
    color: #15803d;
    background: #dcfce7;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid #86efac;
}

.error {
    color: #dc2626;
    text-align: center;
    margin-top: 10px;
}

/* Mobile */
@media (max-width: 600px) {
    #lai-legal-form-container {
        padding: 20px;
        margin: 20px 10px;
        box-shadow: none;
        /* Cleaner on small screens */
        border: 1px solid #e2e8f0;
    }

    .lai-header h2 {
        font-size: 1.5rem;
    }
}

/* --- Suggestion UI (Step 1.5) --- */
#lai-step-suggestion {
    display: none;
    /* Hidden by default */
    text-align: center;
}

#lai-primary-suggestion {
    margin-bottom: 25px;
}

.lai-scope-card-primary {
    display: block;
    width: 100%;
    background: #f0f9ff;
    /* Light blue */
    border: 2px solid #0ea5e9;
    /* Sky 500 */
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    cursor: pointer;
    text-align: left;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.lai-scope-card-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(14, 165, 233, 0.2);
    background: #e0f2fe;
}

.lai-scope-card-primary h3 {
    color: #0c4a6e;
    /* Sky 900 */
    margin: 0 0 10px 0;
    font-size: 1.2rem;
    font-weight: 700;
}

.lai-scope-card-primary p {
    color: #0369a1;
    /* Sky 700 */
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Banner for primary match */
.lai-scope-card-primary::before {
    content: "Sugerencia IA ⭐";
    position: absolute;
    top: 0;
    right: 0;
    background: #0ea5e9;
    color: white;
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: bold;
    border-bottom-left-radius: 12px;
}

#lai-alt-suggestions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.lai-scope-card-alt {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 15px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: #475569;
    transition: all 0.2s;
    min-height: 80px;
}

.lai-scope-card-alt:hover {
    background: #fff;
    border-color: #94a3b8;
    color: #0f172a;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.lai-btn-link {
    background: none;
    border: none;
    color: #64748b;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 10px;
}

.lai-btn-link:hover {
    color: var(--lai-text-head);
}

/* --- UTILITY CLASS (Step E) --- */
.is-hidden {
    display: none !important;
}

/* Report Box (User Step 2) */
.lai-report-box {
    margin-top: 16px;
    padding: 16px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .08);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
    overflow-wrap: anywhere;
}

.lai-report-box p {
    margin: 0 0 10px;
}

.lai-report-box ul {
    margin: 8px 0 0 18px;
}

@media (max-width: 768px) {
    .lai-report-box {
        padding: 14px;
        border-radius: 12px;
    }
}

/* Persistent Report (User Req) */
/* Persistent Report (User Req) */
#lai-persistent-report.lai-persistent-report {
    display: block !important;
    margin-top: 16px !important;
    /* Removed overlay props for internal flow */
}

#lai-persistent-report.lai-persistent-report * {
    max-width: 100%;
}

/* --- LAI Step 4 (Solutions) --- */
.lai-card {
    background: #fff;
    border: 1px solid #e7e7e7;
    border-radius: 12px;
    padding: 16px;
    margin-top: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.lai-solutions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 12px 0;
}

.lai-solution-option {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 10px;
    transition: all 0.2s;
    cursor: pointer;
}

.lai-solution-option:hover {
    background-color: #f9fafb;
    border-color: #dbeafe;
}

.lai-solution-option:has(input:checked) {
    border-color: #2563eb;
    background-color: #eff6ff;
}

.lai-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 15px 0;
}

.lai-grid .lai-input {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: #fff;
    box-sizing: border-box;
}

.lai-btn {
    padding: 12px 20px;
    border-radius: 10px;
    border: 0;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: background 0.2s;
}

.lai-btn-primary {
    background: #111;
    color: #fff;
}

.lai-btn-primary:hover {
    background: #333;
}

@media (max-width: 768px) {
    .lai-grid {
        grid-template-columns: 1fr;
    }

    .lai-grid .lai-input {
        width: 100% !important;
    }
}

/* === LAI UI (Report + Step 4) === */
.lai-card {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 14px;
    padding: 16px;
    margin: 12px 0;
}

.lai-report-box {
    line-height: 1.55;
    font-size: 15px;
}

.lai-step4 {
    margin-top: 14px;
}

.lai-step4 h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
}

.lai-step4 .lai-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.lai-step4 label {
    display: block;
    font-size: 13px;
    margin-bottom: 6px;
    opacity: .85;
}

.lai-step4 input[type="text"],
.lai-step4 input[type="tel"],
.lai-step4 input[type="email"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(0, 0, 0, .12);
    border-radius: 10px;
    outline: none;
}

.lai-step4 .lai-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.lai-step4 button {
    padding: 10px 14px;
    border-radius: 10px;
    border: 0;
    cursor: pointer;
    font-weight: 600;
}

.lai-step4 button.lai-primary {
    background: #111;
    color: #fff;
}

.lai-step4 button.lai-secondary {
    background: rgba(0, 0, 0, .06);
    color: #111;
}

/* Mobile */
@media (max-width: 720px) {
    .lai-step4 .lai-grid {
        grid-template-columns: 1fr;
    }
}

/* --- LAI STEP 4 REFINED (User Req D) --- */
.lai-step4-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f1f5f9;
}

.lai-step4-header h3 {
    margin: 0 0 10px;
    color: #1a1a1a;
    font-size: 1.3rem;
}

.lai-step4-header p {
    color: #666;
    font-size: 0.95em;
    margin: 0;
    line-height: 1.4;
}

.lai-step4-form h4 {
    margin: 25px 0 15px;
    font-size: 1.1em;
    color: #333;
    font-weight: 600;
}

.lai-form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.lai-info-text {
    background: #eff6ff;
    /* Blue 50 */
    color: #1e40af;
    /* Blue 800 */
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.95em;
    border: 1px solid #dbeafe;
    margin: 20px 0;
    text-align: center;
    line-height: 1.5;
}

.lai-warning-text {
    background: #fffbeb;
    /* Amber 50 */
    color: #92400e;
    /* Amber 800 */
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.95em;
    border: 1px solid #fcd34d;
    margin: 20px 0;
    text-align: center;
    line-height: 1.5;
}

.lai-step4 .full-width {
    width: 100%;
    justify-content: center;
}

.lai-step4 textarea.lai-input {
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
}

@media (max-width: 600px) {
    .lai-form-row {
        flex-direction: column;
        gap: 10px;
    }
}

/* --- LAI STEP 4 PREMIUM & RESPONSIVE (User Req 5) --- */
.lai-step4-wrap {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    padding: 30px;
    margin-top: 20px;
}

.lai-step4-form h4 {
    margin: 25px 0 15px;
    font-size: 1.15em;
    font-weight: 700;
    color: #1f2937;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 8px;
    display: inline-block;
}

.lai-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    color: #111827;
    transition: all 0.2s ease-in-out;
    background-color: #f9fafb;
    outline: none;
}

.lai-input:focus {
    background-color: #fff;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.lai-btn.full-width {
    width: 100%;
    padding: 16px;
    font-size: 1.1em;
    font-weight: 600;
    justify-content: center;
    border-radius: 8px;
    margin-top: 10px;
    transition: transform 0.1s ease;
}

.lai-btn.full-width:active {
    transform: scale(0.98);
}

.lai-info-text,
.lai-warning-text {
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

/* Responsive Grid Helper */
.lai-step4-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 600px) {
    .lai-step4-grid {
        grid-template-columns: 1fr;
    }

    .lai-step4-wrap {
        padding: 20px;
    }
}