#gaip-hub {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #ddd;
    background: #f9fafb;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}
#gaip-hub h2 {
    margin-top: 0;
    margin-bottom: 10px;
}
.gaip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 10px;
}

/* Collapsible Card Styles */
.gaip-card {
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.gaip-card-header {
    padding: 10px;
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f3f4f6;
    border-bottom: 1px solid #e5e7eb;
}

.gaip-card-header h3 {
    margin: 0;
    font-size: 15px;
    flex: 1;
}

.gaip-header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.gaip-module-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    padding: 4px 8px;
    background: #ffffff;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    transition: background-color 0.2s;
}

.gaip-module-toggle:hover {
    background: #f9fafb;
}

.gaip-module-toggle input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

.gaip-module-toggle span {
    white-space: nowrap;
}

.gaip-card-header:hover {
    background: #e5e7eb;
}

.gaip-card-toggle {
    font-size: 18px;
    font-weight: bold;
    color: #6b7280;
    transition: transform 0.2s;
}

.gaip-card.collapsed .gaip-card-toggle {
    transform: rotate(-90deg);
}

.gaip-card-body {
    padding: 10px;
    display: block;
}

.gaip-card.collapsed .gaip-card-body {
    display: none;
}

/* Original styles continue */
.gaip-card h3 {
    margin: 0;
    font-size: 15px;
}
.gaip-card h4 {
    margin-top: 10px;
    margin-bottom: 4px;
    font-size: 13px;
}
.gaip-card label {
    display: block;
    margin-top: 4px;
    margin-bottom: 2px;
    font-weight: 500;
}
.gaip-card input[type="text"],
.gaip-card input[type="number"],
.gaip-card input[type="date"],
.gaip-card select {
    width: 100%;
    box-sizing: border-box;
    padding: 4px 6px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    font-size: 13px;
}
.gaip-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}
.gaip-note {
    font-size: 12px;
    color: #6b7280;
    margin: 4px 0 6px;
}
.gaip-dates {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}
.gaip-dates input {
    flex: 1;
}
.gaip-grid-mini {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 8px;
    margin-bottom: 6px;
}
.gaip-grid-mini .gaip-row {
    display: contents;
}
.gaip-grid-mini span {
    font-size: 12px;
    align-self: center;
}
.gaip-grid-mini input[type="number"] {
    width: 100%;
    padding: 3px 4px;
    font-size: 12px;
}
.gaip-run-btn {
    margin-top: 4px;
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid #2563eb;
    background: #2563eb;
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
}
.gaip-run-btn:hover {
    opacity: 0.9;
}
.gaip-results {
    margin-top: 14px;
    border-top: 1px solid #e5e7eb;
    padding-top: 10px;
}
.gaip-results h3 {
    margin-top: 0;
    margin-bottom: 8px;
}
.gaip-result-block {
    margin-bottom: 8px;
    padding: 8px 10px;
    background: #ffffff;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}
.gaip-result-block h4 {
    margin: 0 0 4px;
    font-size: 13px;
}
.gaip-result-body {
    font-size: 12px;
    color: #374151;
}

/* ============================================================
   INNER COLLAPSIBLE SECTIONS (within results)
   ============================================================ */
.gaip-collapsible {
    margin-bottom: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    background: #ffffff;
}

.gaip-collapsible-btn {
    width: 100%;
    padding: 10px 12px;
    background: #f9fafb;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s ease;
}

.gaip-collapsible-btn:hover {
    background: #f3f4f6;
}

.gaip-collapsible-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
}

.gaip-collapsible-btn::after {
    content: '▼';
    font-size: 12px;
    color: #6b7280;
    transition: transform 0.2s ease;
}

.gaip-collapsible-btn.active::after {
    transform: rotate(180deg);
}

.gaip-collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: #ffffff;
}

.gaip-collapsible-content > * {
    padding: 12px;
}

.gaip-collapsible-content p {
    margin: 0 0 10px 0;
    line-height: 1.6;
}

.gaip-collapsible-content p:last-child {
    margin-bottom: 0;
}

.gaip-collapsible-content hr {
    margin: 12px 0;
    border: none;
    border-top: 1px solid #e5e7eb;
}

.gaip-collapsible-content strong {
    color: #1f2937;
    font-weight: 600;
}

/* ============================================================
   MLSN TABLE STYLES
   ============================================================ */
.gaip-mlsn-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 12px;
    background: #ffffff;
}

.gaip-mlsn-table thead {
    background: #f3f4f6;
}

.gaip-mlsn-table th {
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
}

.gaip-mlsn-table td {
    padding: 8px;
    border-bottom: 1px solid #f3f4f6;
}

.gaip-mlsn-table tbody tr:hover {
    background: #f9fafb;
}

/* Status badge styling */
.status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.deficient {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.borderline {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.adequate {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.high {
    background: #dbeafe;
    color: #1e40af;
}

.status-badge.no-data {
    background: #f3f4f6;
    color: #6b7280;
}

/* Row highlighting based on status */
.gaip-mlsn-table tr.status-deficient {
    background: #fef2f2;
}

.gaip-mlsn-table tr.status-borderline {
    background: #fffbeb;
}

.gaip-mlsn-table tr.status-adequate {
    background: #f0fdf4;
}

/* Status indicator styles */
.gaip-status {
    padding: 10px;
    border-radius: 6px;
    font-size: 13px;
    margin: 10px 0;
}

.gaip-status.loading {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.gaip-status.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.gaip-status.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* ============================================================
   WEAR & RECOVERY ENGINE v1.1 STYLES
   Source: Baker/Gibbs/Adams STRI, GMA UK, Gilba Solutions
   ============================================================ */

/* Form grid for side-by-side inputs */
.gaip-form-row-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.gaip-form-row {
    margin-bottom: 8px;
}

.gaip-prior-weeks input::placeholder {
    color: #aaa;
    font-style: italic;
}

/* Capacity utilization bar */
.gaip-risk-bar-container {
    width: 100%;
    background: #eee;
    border-radius: 6px;
    height: 18px;
    margin-top: 10px;
    overflow: hidden;
}

.gaip-risk-bar {
    height: 18px;
    width: 0%;
    background: #4caf50;
    transition: width 300ms ease, background 300ms ease;
}

/* Action priority badges */
.gaip-priority-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
}

.gaip-priority-low {
    background: #e8f5e9;
    color: #2e7d32;
}

.gaip-priority-medium {
    background: #fff8e1;
    color: #f57f17;
}

.gaip-priority-high {
    background: #ffebee;
    color: #c62828;
}

/* Stress status indicators */
.gaip-stress-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.gaip-stress-recovering {
    background: #e8f5e9;
    color: #2e7d32;
}

.gaip-stress-stable {
    background: #e3f2fd;
    color: #1565c0;
}

.gaip-stress-stressed {
    background: #fff8e1;
    color: #f57f17;
}

.gaip-stress-critical {
    background: #ffebee;
    color: #c62828;
}

/* Load breakdown table */
.gaip-load-breakdown {
    width: 100%;
    font-size: 12px;
    border-collapse: collapse;
    margin-top: 8px;
}

.gaip-load-breakdown th,
.gaip-load-breakdown td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.gaip-load-breakdown th {
    background: #f5f5f5;
    font-weight: 600;
}

/* Recommendation cards */
.gaip-recommendation {
    padding: 10px 12px;
    margin: 8px 0;
    border-radius: 6px;
    font-size: 13px;
}

.gaip-recommendation-critical {
    background: #ffebee;
    border-left: 4px solid #c62828;
}

.gaip-recommendation-warning {
    background: #fff8e1;
    border-left: 4px solid #f57f17;
}

.gaip-recommendation-positive {
    background: #e8f5e9;
    border-left: 4px solid #2e7d32;
}

.gaip-recommendation .rec-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.gaip-recommendation .rec-action {
    color: #555;
    font-size: 12px;
}

/* Aeration schedule styling */
.gaip-aeration-schedule {
    margin-top: 12px;
    padding: 10px;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.gaip-aeration-schedule .schedule-header {
    font-weight: 600;
    margin-bottom: 8px;
    color: #334155;
}

.gaip-aeration-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 12px;
    border-bottom: 1px dashed #e2e8f0;
}

.gaip-aeration-item:last-child {
    border-bottom: none;
}

.gaip-aeration-item .aeration-type {
    color: #475569;
}

.gaip-aeration-item .aeration-timing {
    color: #64748b;
    font-style: italic;
}

/* Compaction risk meter */
.gaip-compaction-meter {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
}

.gaip-compaction-meter .meter-bar {
    flex: 1;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.gaip-compaction-meter .meter-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 300ms ease;
}

.gaip-compaction-meter .meter-label {
    font-size: 11px;
    font-weight: 600;
    min-width: 60px;
    text-align: right;
}

/* Overseed vulnerability indicator */
.gaip-overseed-alert {
    margin: 10px 0;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gaip-overseed-alert.vulnerable {
    background: #fef3c7;
    border: 1px solid #fbbf24;
    color: #92400e;
}

.gaip-overseed-alert.protected {
    background: #d1fae5;
    border: 1px solid #34d399;
    color: #065f46;
}

.gaip-overseed-alert .alert-icon {
    font-size: 16px;
}

/* Section dividers in traffic card */
.gaip-card-body .section-divider {
    margin: 16px 0 12px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

.gaip-card-body .section-divider strong {
    color: #2c5f2d;
    font-size: 13px;
}

/* Responsive adjustments for wear/recovery inputs */
@media (max-width: 480px) {
    .gaip-form-row-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .gaip-load-breakdown th,
    .gaip-load-breakdown td {
        padding: 4px 6px;
        font-size: 11px;
    }
    
    .gaip-priority-badge,
    .gaip-stress-status {
        font-size: 10px;
        padding: 3px 6px;
    }
}
