/* === RRAT TOOL STYLESHEET - WITH TAILWIND FALLBACK === */
/* 
 * PRIMARY: Uses embedded CSS for offline/CDN-unavailable scenarios
 * SECONDARY: Enhances with CDN-loaded Tailwind when available (index.html)
 * This stylesheet ensures full functionality and styling regardless of internet connection.
 */

/* ===== BASE STYLES ===== */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #f9fafb; /* bg-gray-50 */
    color: #1f2937; /* text-gray-800 */
    padding: 1rem; /* p-4 */
}

@media (min-width: 640px) {
    body {
        padding: 1.5rem; /* sm:p-6 */
    }
}

@media (min-width: 1024px) {
    body {
        padding: 2rem; /* lg:p-8 */
    }
}

/* ===== LAYOUT UTILITIES ===== */
.max-w-container {
    max-width: 56rem; /* max-w-7xl = 112rem/2 */
    margin-left: auto;
    margin-right: auto;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

/* ===== GRID UTILITIES ===== */
.grid-container {
    display: grid;
    gap: 1rem; /* gap-4 */
}

@media (min-width: 768px) {
    .grid-container.md-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr)); /* md:grid-cols-3 */
    }
    
    .grid-container.md-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr)); /* md:grid-cols-2 */
    }
}

/* ===== COLOR UTILITIES (Tailwind equivalents) ===== */
.bg-gray-50 { background-color: #f9fafb; }
.bg-gray-100 { background-color: #f3f4f6; }
.bg-gray-200 { background-color: #e5e7eb; }
.bg-white { background-color: #ffffff; }

.bg-indigo-50 { background-color: #eef2ff; }
.bg-indigo-100 { background-color: #e0e7ff; }
.bg-indigo-600 { background-color: #4f46e5; }
.bg-indigo-700 { background-color: #4338ca; }

.bg-blue-50 { background-color: #eff6ff; }
.bg-blue-100 { background-color: #dbeafe; }
.bg-blue-200 { background-color: #bfdbfe; }

.bg-purple-200 { background-color: #e9d5ff; }

.bg-yellow-100 { background-color: #fef3c7; }

.bg-red-100 { background-color: #fee2ee; }
.bg-red-600 { background-color: #dc2626; }

.bg-orange-200 { background-color: #fed7aa; }

.bg-green-100 { background-color: #d1fae5; }

.text-gray-800 { color: #1f2937; }
.text-gray-900 { color: #111827; }
.text-gray-700 { color: #374151; }
.text-gray-600 { color: #4b5563; }
.text-gray-500 { color: #6b7280; }
.text-gray-400 { color: #9ca3af; }

.text-indigo-900 { color: #312e81; }
.text-indigo-800 { color: #4338ca; }
.text-indigo-700 { color: #4f46e5; }
.text-indigo-600 { color: #6366f1; }

.text-blue-700 { color: #2563eb; }
.text-blue-800 { color: #1d4ed8; }

.text-purple-800 { color: #7e22ce; }

.text-orange-500 { color: #f97316; }
.text-orange-600 { color: #ea580c; }

.text-yellow-600 { color: #ca8a04; }

.text-green-600 { color: #16a34a; }

.text-red-600 { color: #dc2626; }

.text-cyan-600 { color: #0891b2; }

/* ===== TYPOGRAPHY UTILITIES ===== */
.text-center { text-align: left; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.font-normal { font-weight: 400; }

.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-md { font-size: 1rem; line-height: 1.5rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }

/* ===== SPACING UTILITIES ===== */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-8 { margin-bottom: 2rem; }

.ml-2 { margin-left: 0.5rem; }
.ml-4 { margin-left: 1rem; }
.mr-2 { margin-right: 0.5rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }

/* ===== BORDER UTILITIES ===== */
.border { border-width: 1px; border-style: solid; }
.border-gray-300 { border-color: #d1d5db; }
.border-blue-200 { border-color: #bfdbfe; }
.border-indigo-300 { border-color: #c7d2fe; }

.rounded { border-radius: 0.25rem; }
.rounded-md { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-full { border-radius: 9999px; }

/* ===== SHADOW UTILITIES ===== */
.shadow { box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); }

/* ===== FLEX UTILITIES ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }

.items-center { align-items: center; }
.items-start { align-items: flex-start; }

.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }

.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }

.space-x-2 > * + * { margin-left: 0.5rem; }
.space-x-4 > * + * { margin-left: 1rem; }

/* ===== VISIBILITY UTILITIES ===== */
.hidden { display: none !important; }

.block { display: block; }

.inline-block { display: inline-block; }

/* ===== WIDTH/SIZE UTILITIES ===== */
.w-full { width: 100%; }
.w-20 { width: 5rem; }
.w-6 { width: 1.5rem; }
.w-4 { width: 1rem; }

.h-6 { height: 1.5rem; }

/* === Section Title Alignment === */
.section-title {
    height: 1.5rem;
    line-height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.h-4 { height: 1rem; }

/* ===== RESPONSIVE DESIGN (Desktop/Tablet/Mobile) ===== */
@media (max-width: 768px) {
    /* Mobile adjustments */
    .text-xl { font-size: 1.125rem; }
    .p-4 { padding: 0.75rem; }
    
    .grid-container.md-cols-3 {
        grid-template-columns: repeat(1, minmax(0, 1fr)); /* Stack on mobile */
    }
}

@media (min-width: 640px) and (max-width: 1024px) {
    /* Tablet adjustments */
    .grid-container.md-cols-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr)); /* 2 columns on tablet */
    }
}

/* ===== EXISTING CUSTOM STYLES (Preserved from original styles.css) ===== */
body {
    font-family: 'Inter', sans-serif;
}

.rating-card {
    transition: all 0.3s ease-in-out;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

/* === SECTION HEADER ALIGNMENT FIX (Session 22) === */
/* Force vertical centering on all flex children within section headers */
.section-header td > div,
.section-header td > div > div,
.section-header td > div > div > label,
.section-header td > div > div > button,
.section-header td > div > div > span,
.section-header td > div > div > input,
.section-header td > div > div > select,
.section-header td > div > div > .toggle-switch,
.section-header td > div > div > .rating-text,
.section-header td > div > div > .chevron-icon,
.section-header td > div > div > .tooltip-container,
.section-header td > div > div > .carry-over-container,
.section-header td > div > div > .details-btn,
.section-header td > div > div > .toggle-label {
    align-items: center !important;
    vertical-align: middle !important;
}

/* === SECTION HEADER ALIGNMENT FIX (Session 23) === */
/* Ensure all section title spans are vertically centered */


/* Ensure all checkbox+label containers in section headers are vertically centered */
.section-header td > div > div[style*="height: 1.5rem"],
.section-header td > div > label.h-6,
.section-header td > div > div > label.h-6,
.section-header td > div > div > label[style*="height: 1.5rem"] {
    align-items: center !important;
    display: flex !important;
}

/* Ensure outer header div stays on one line (title + controls), only inner controls div wraps */
.section-header td > div {
    flex-wrap: nowrap !important;
}
.section-header td > div > div.flex-wrap {
    flex-wrap: wrap !important;
}

.section-header td {
    justify-content: space-between;
    align-items: center;
}

select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

textarea {
    resize: vertical;
}

/* Mitigation measure description textareas — resizable from bottom-right corner */
.mitigation-desc-textarea {
    resize: both;
    min-width: 200px;
    min-height: 2.5rem;
    overflow: auto;
}

.rating-text {
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.875rem;
}

.matrix-table th, .matrix-table td {
    border: 1px solid #d1d5db;
    padding: 0.5rem;
    text-align: center;
}

/* Left-justify Standard Pathways Reference table cells */
#standard-pathways-reference-table th,
#standard-pathways-reference-table td {
    text-align: left !important;
}

/* Left-justify Consequence Calculation Reference table cells */
#consequence-calculation-reference-table th:nth-child(1),
#consequence-calculation-reference-table td:nth-child(1),
#consequence-calculation-reference-table th:nth-child(2),
#consequence-calculation-reference-table td:nth-child(2) {
    text-align: left !important;
}

/* Center-justify Local/District/Regional/National columns in Consequence Calculation Reference table */
#consequence-calculation-reference-table th:nth-child(n+3),
#consequence-calculation-reference-table td:nth-child(n+3) {
    text-align: center !important;
}

/* Left-justified columns for Reference Diagrams */
.matrix-table-left {
    text-align: left !important;
    padding-left: 1rem !important;
    font-weight: 600;
}

/* Specific rules for Risk Estimation Matrix - Likelihood column */
#matrix-container th:first-child,
#likelihood-combination-container th:first-child {
    text-align: left !important;
    padding-left: 1rem !important;
    font-weight: 600;
}

/* Specific rules for Pest Archetype Weightings - Factor column */
#archetype-weights-table thead th:first-child,
#archetype-weights-table tbody tr th:first-child {
    text-align: left !important;
    padding-left: 1rem !important;
    font-weight: 600;
}

#scientific-name-input {
    font-style: italic;
}

.consequence-header {
    background-color: #e5e7eb; 
}

.carry-over-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 1rem;
}

.carry-over-container label {
    font-size: 0.75rem;
    margin-left: 0.25rem;
    color: #6b7280;
    cursor: pointer;
}

.weight-input {
    width: 70px;
    text-align: center;
    border-radius: 0.375rem;
    border: 1px solid #d1d5db;
    padding: 0.25rem 0.5rem;
    margin-left: 0.5rem;
    font-family: monospace;
}

.section-toggle {
    cursor: pointer;
}

.chevron-icon {
    transition: transform 0.2s ease-in-out;
    width: 1.25rem;
    height: 1.25rem;
}

.chevron-icon.rotated {
    transform: rotate(-180deg);
}

.collapsible-content.collapsed {
    display: none;
}

/* Styles for the new toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #4f46e5;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.toggle-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #4b5563;
    margin-right: 0.5rem;
}

.manual-select-container {
    display: none; /* Hidden by default */
}

.manual-select {
    width: 150px; /* Fixed width for the manual dropdown */
    font-size: 0.875rem;
}

/* Style for disabled inputs */
:disabled {
    background-color: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.7;
}

select:disabled {
    background-image: none; /* Remove arrow on disabled select */
}

#likelihood-table th,
#likelihood-table td:nth-child(1) {
    text-align: left;
    padding-left: 1rem;
    font-weight: 600; 
}

#likelihood-table td:nth-child(2) {
    text-align: left;
    padding-left: 1rem;
}

.details-btn {
    background-color: #e0e7ff; 
    color: #4338ca; 
    border: 1px solid #c7d2fe; 
    border-radius: 9999px; 
    width: 1.5rem;
    height: 1.5rem;
    font-weight: 700;
    font-size: 0.875rem;
    line-height: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.5rem;
}

.details-btn:hover {
    background-color: #c7d2fe; 
}

#details-modal-content ul {
    list-style-type: disc;
    list-style-position: inside;
    margin-left: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

#details-modal-content li {
    margin-top: 0.5rem;
}

#details-modal-content code {
    background-color: #e5e7eb; 
    color: #1f2937; 
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: monospace;
    font-size: 0.875rem;
}

.validation-error {
    border: 2px solid #ef4444 !important; 
    background-color: #fef2f2 !important; 
}

/* --- NEW: TOOLTIP STYLES (HTML-Based) --- */
.tooltip-container {
    position: relative;
    display: inline-block;
    margin-left: 6px;
    vertical-align: middle;
}

.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    background-color: #e0e7ff; /* indigo-100 */
    color: #4338ca; /* indigo-700 */
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: help;
}

/* The Tooltip Bubble (Using .tooltip-content class now) */
.tooltip-content {
    position: absolute;
    bottom: 150%; /* Default: Position above */
    left: 50%;
    transform: translateX(-50%);
    background-color: #1f2937; /* gray-800 */
    color: #fff;
    padding: 0.75rem; /* Slightly more padding for readability */
    border-radius: 0.375rem;
    font-size: 0.75rem;
    white-space: normal; /* Allow text wrapping */
    width: max-content;
    max-width: 280px; /* Wider for rich text */
    line-height: 1.4; /* Better line height for text blocks */
    z-index: 9999;
    
    /* Transition Logic */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    
    /* Text alignment */
    text-align: left;
}

/* The Arrow */
.tooltip-content::before {
    content: "";
    position: absolute;
    top: 100%; /* Default: At the bottom of the bubble */
    left: 50%;
    margin-left: -5px; /* Center the 10px arrow */
    border-width: 5px;
    border-style: solid;
    border-color: #1f2937 transparent transparent transparent;
}

/* --- TOOLTIP DOWN VARIANT (For Headers) --- */
/* Override default "bottom" positioning to place it below the icon */
.tooltip-container.tooltip-down .tooltip-content {
    bottom: auto;
    top: 150%; /* Push it down below the icon */
}

/* Override default arrow to point UP */
.tooltip-container.tooltip-down .tooltip-content::before {
    top: auto;
    bottom: 100%; /* Place arrow at the top of the bubble */
    border-color: transparent transparent #1f2937 transparent; /* Point UP */
}

/* Show on Hover or Focus */
.tooltip-container:hover .tooltip-content,
.tooltip-container:focus-within .tooltip-content {
    opacity: 1;
    visibility: visible;
}

/* --- Enhancement H: Pinnable Tooltip Styles --- */
/* Pinned tooltip stays visible even when mouse leaves */
.tooltip-container.tooltip-pinned .tooltip-content {
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    border: 2px solid #4338ca; /* indigo-700 */
    z-index: 99999 !important;
}

/* Pinned icon styling */
.tooltip-container.tooltip-pinned .tooltip-icon {
    background-color: #4338ca !important; /* indigo-700 */
    color: #fff !important; /* white */
    cursor: pointer;
}

/* Close button in pinned tooltip */
.tooltip-close {
    position: absolute;
    top: 4px;
    right: 8px;
    background: none;
    border: none;
    color: #9ca3af; /* gray-400 */
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 2px;
    transition: color 0.15s, background-color 0.15s;
}

.tooltip-close:hover {
    color: #fff; /* white */
    background-color: rgba(255, 255, 255, 0.15);
}
/* --- End Enhancement H: Pinnable Tooltip Styles --- */

/* --- NEW: USER GUIDE ACCORDION --- */
.guide-accordion-btn {
    width: 100%;
    text-align: left;
    padding: 1rem;
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.guide-accordion-btn:hover {
    background-color: #f3f4f6;
}

.guide-content {
    display: none;
    padding: 1rem;
    background-color: white;
    font-size: 0.9rem;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
}

.guide-content.active {
    display: block;
}

/* --- PART G: HOLISTIC INPUT STYLES --- */
.holistic-input {
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.holistic-input:focus {
    outline: none;
    border-color: #6366f1; /* indigo-500 */
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* ===== FALLBACK DETECTION SYSTEM ===== */
/* When Tailwind CDN fails to load, these classes activate automatically */
@supports not (background-color: rgb(79 70 229)) {
    /* Tailwind not available - fallback styles active */
    
    .bg-indigo-600, .bg-indigo-700 { background-color: #4f46e5 !important; }
    .text-indigo-800, .text-indigo-700 { color: #4338ca !important; }
    
    /* Ensure all utility classes work without Tailwind */
    * {
        box-sizing: border-box;
    }
}

/* ===== Enhancement D: Locked Likelihood Section Styling ===== */
/* Applied to Parts C & D when "Lock Likelihoods" is checked */
.likelihood-locked-section {
    border: 2px solid #ea580c; /* orange-600 */
    border-radius: 0.5rem;
    position: relative;
    background-color: #fff7ed; /* orange-50 */
    padding: 1rem;
    margin-bottom: 1rem;
}

.likelihood-locked-badge {
    position: absolute;
    top: -10px;
    right: 10px;
    background-color: #ea580c; /* orange-600 */
    color: white;
    padding: 2px 8px;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

/* ===== Enhancement E: Manual Override Badge Styling ===== */
.manual-override-badge {
    display: none;
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background-color: #fef3c7; /* amber-100 */
    border: 1px solid #f59e0b; /* amber-500 */
    border-radius: 0.375rem;
    color: #92400e; /* amber-800 */
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* ===== CENTRALIZED CHECKBOX ROW STYLES ===== */
.centralized-checkbox-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background-color: #fff7ed; /* orange-50 */
    border: 1px solid #fed7aa; /* orange-200 */
    border-radius: 0.5rem;
    margin: 0.5rem 0;
    gap: 1rem;
}

.centralized-checkbox-row .checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #ea580c; /* orange-600 */
}

.centralized-checkbox-row .checkbox-label input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

.centralized-checkbox-row .checkbox-label span {
    color: #ea580c;
}

.centralized-checkbox-row .info-text {
    font-size: 0.75rem;
    color: #9ca3af; /* gray-400 */
}

/* Ensure centralized checkbox row aligns vertically with section headers */
.centralized-checkbox-row,
.section-header {
    align-items: center;
}

/* ===== END OF FILE - COMPLETE FALLBACK IMPLEMENTATION ===== */


/* === Session 39: Disabled Question Row Styling === */
/* Visual styling for disabled likelihood factors (Parts A-D) */
.disabled-question-checkbox {
    cursor: pointer;
    accent-color: #9ca3af; /* gray-400 */
}

.disabled-question-checkbox:checked {
    accent-color: #6b7280; /* gray-500 */
}

/* Disabled badge styling */
.disabled-badge {
    color: #6b7280 !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
}


/* ===== Part E: Per-Cell Consequence Hover Tooltips (Hover-only) ===== */
/* Tooltip wrapper around each consequence dropdown cell */
.consequence-cell-tooltip-wrapper {
    position: relative;
    z-index: 1;
}

/* Ensure wrapper sits on top when tooltip is shown */
.consequence-cell-tooltip-wrapper:hover {
    z-index: 9998;
}

/* The tooltip content - positioned above the dropdown to avoid obscuring it */
.cons-cell-tooltip-content {
    position: fixed; /* Use fixed positioning to escape ALL parent clipping contexts */
    top: 0; /* Will be set dynamically via JS based on hovered element */
    left: 50%;
    transform: translateX(-50%);
    background-color: #1f2937; /* gray-800 */
    color: #fff;
    padding: 0.4rem 0.6rem;
    border-radius: 0.375rem;
    font-size: 0.7rem;
    line-height: 1.35;
    white-space: normal;
    width: max-content;
    max-width: 220px;
    z-index: 99999; /* Ensure tooltip is always on top, above all parents */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.15);

    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* Arrow pointing down from tooltip bubble */
.cons-cell-tooltip-content::after {
    content: "";
    position: absolute;
    top: 100%; /* At bottom of bubble */
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #1f2937 transparent transparent transparent;
}

/* Show tooltip on hover over the wrapper */
.consequence-cell-tooltip-wrapper:hover .cons-cell-tooltip-content {
    opacity: 1;
    visibility: visible;
}

/* ===== Priority 9b: Consequence Justification Slid-Out Panels ===== */
/* Slid-out justification panel styling */
.consequence-justification-panel {
    position: relative;
    margin-top: 0.5rem;
    border-radius: 0.375rem;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease-in-out;
}

.consequence-justification-panel.hidden {
    display: none;
}

/* Panel header styling */
.consequence-justification-panel .panel-header {
    background-color: #eef2ff; /* indigo-50 */
    border-bottom: 1px solid #c7d2fe; /* indigo-200 */
}

/* Panel content styling */
.consequence-justification-panel .panel-content {
    background-color: #fff;
}

/* Justification textarea styling */
.consequence-justification-input {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.consequence-justification-input:focus {
    outline: none;
    border-color: #6366f1; /* indigo-500 */
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Justify toggle button styling */
.justify-toggle-btn {
    font-size: 0.625rem; /* 10px */
    line-height: 1rem;
    padding: 0.125rem 0.375rem; /* 2px 6px */
    border-radius: 0.25rem; /* 4px */
    transition: background-color 0.15s ease-in-out, transform 0.1s ease-in-out;
}

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

.justify-toggle-btn:active {
    transform: translateY(0);
}

/* Panel animation */
.consequence-justification-panel {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .consequence-justification-panel .panel-header span {
        font-size: 0.75rem; /* Reduce text size on mobile */
    }
    
    .consequence-justification-input {
        font-size: 0.875rem; /* Slightly larger text for mobile */
    }
}

/* Accessibility: Focus styles */
.consequence-justification-panel:focus-within {
    box-shadow: 0 0 0 2px #4338ca; /* indigo-700 */
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ===== Workbench Modal Fallback Classes (Tailwind CDN unavailable) ===== */

/* Overlay classes */
.fixed { position: fixed; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.bg-gray-600 { background-color: rgba(75, 85, 99, var(--tw-bg-opacity, 1)); }
.bg-opacity-50 { --tw-bg-opacity: 0.5; }
.h-full { height: 100%; }
.z-\[50\], .z-50 { z-index: 50; }

/* Positioning */
.relative { position: relative; }
.top-10 { top: 2.5rem; }

/* Container classes */
.max-w-3xl { max-width: 48rem; }
.shadow-xl { box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04); }
.overflow-hidden { overflow: hidden; }

/* Color classes */
.bg-green-600 { background-color: #16a34a; }
.text-white { color: #ffffff; }

/* Scroll and sizing */
.overflow-y-auto { overflow-y: auto; }
.max-h-\[90vh\] { max-height: 90vh; }
.space-y-1 > * + * { margin-top: 0.25rem; }

/* Form classes */
.outline-none { outline: none; }

/* Flexbox utilities */
.flex-shrink-0 { flex-shrink: 0; }
.min-w-0 { min-width: 0; }

/* Text truncation */
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Animation */
.animate-pulse { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Disabled states */
.disabled\:opacity-50:disabled { opacity: 0.5; }
.disabled\:cursor-not-allowed:disabled { cursor: not-allowed; }

/* Workbench modal overlay - ensure it displays when shown */
#workbench-modal:not(.hidden) { display: flex; align-items: center; justify-content: center; }

/* Ensure workbench content text is visible */
#workbench-content { color: #1f2937; }
#workbench-output { color: #111827; background-color: #ffffff; }

/* Merge button visibility */
#workbench-merge-btn:not(.hidden) { display: inline-block; }

/* Section 4 Pest Auto-complete Dropdown */
#wb-pest-autocomplete-dropdown {
    max-height: 240px; /* 60 * 4 (max-h-60 in Tailwind is 15rem = 240px) */
}

#wb-pest-autocomplete-dropdown .autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #e5e7eb;
    font-size: 13px;
    color: #374151;
}

#wb-pest-autocomplete-dropdown .autocomplete-item:last-child {
    border-bottom: none;
}

#wb-pest-autocomplete-dropdown .autocomplete-item:hover,
#wb-pest-autocomplete-dropdown .autocomplete-item.active {
    background-color: #f3f4f6;
    color: #111827;
}

/* ===== END OF FILE ===== */
