/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

/* Progress Bar */
.progress-bar {
    display: flex;
    justify-content: space-between;
    padding: 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.progress-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    opacity: 0.5;
}

.progress-step.active,
.progress-step.completed {
    opacity: 1;
}

.progress-step::after {
    content: '';
    position: absolute;
    top: 20px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: #dee2e6;
    z-index: 0;
}

.progress-step:last-child::after {
    display: none;
}

.progress-step.completed::after {
    background: #28a745;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    z-index: 1;
    position: relative;
}

.progress-step.active .step-number {
    background: #667eea;
    color: white;
}

.progress-step.completed .step-number {
    background: #28a745;
    color: white;
}

.step-label {
    margin-top: 10px;
    font-size: 0.85em;
    text-align: center;
    font-weight: 500;
}

/* Step Content */
.step-content {
    display: none;
    padding: 40px;
}

.step-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

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

.step-content h2 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 2em;
}

.description {
    color: #6c757d;
    margin-bottom: 30px;
    font-size: 1.1em;
}

/* Form Styles */
.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #495057;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 5px;
    font-size: 1em;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input[type="text"]:focus,
.form-group input[type="date"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
    accent-color: #38bdf8;
}

/* Hazard Categories */
.hazard-categories {
    display: grid;
    gap: 20px;
}

.hazard-category {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid #dee2e6;
}

.hazard-category h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.hazard-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
}

.hazard-list label {
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 5px;
    transition: background 0.2s;
    cursor: pointer;
}

.hazard-list label:hover {
    background: white;
}

.hazard-checkbox {
    margin-right: 10px;
    cursor: pointer;
}

/* Risk Cards */
.risk-card {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.risk-card h4 {
    color: #495057;
    margin-bottom: 15px;
}

.risk-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 15px;
}

.risk-input-group {
    display: flex;
    flex-direction: column;
}

.risk-input-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #495057;
}

.risk-input-group select {
    padding: 10px;
    border: 2px solid #dee2e6;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
}

.risk-input-group textarea {
    padding: 10px;
    border: 2px solid #dee2e6;
    border-radius: 5px;
    font-size: 1em;
    font-family: inherit;
    resize: vertical;
}

.risk-level {
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
    margin-top: 10px;
}

.risk-badge {
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9em;
}

.risk-badge.low,
.risk-level.low {
    background: #d4edda;
    color: #155724;
}

.risk-badge.medium,
.risk-level.medium {
    background: #fff3cd;
    color: #856404;
}

.risk-badge.high,
.risk-level.high {
    background: #f8d7da;
    color: #721c24;
}

.risk-badge.very-high,
.risk-level.very-high {
    background: #721c24;
    color: white;
}

/* Risk Matrix Legend */
.risk-matrix-legend {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.risk-matrix-legend h3 {
    color: #667eea;
    margin-bottom: 15px;
}

.legend-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Risk Reduction Hierarchy */
.risk-reduction-hierarchy {
    margin-bottom: 30px;
}

.hierarchy-item {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 5px solid #667eea;
}

.hierarchy-number {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #667eea;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    font-weight: bold;
    flex-shrink: 0;
}

.hierarchy-content h4 {
    color: #495057;
    margin-bottom: 5px;
}

.hierarchy-content p {
    color: #6c757d;
    font-size: 0.95em;
}

/* Report Styles */
#reportContent {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 8px;
    line-height: 1.8;
}

#reportContent h3 {
    color: #667eea;
    margin-top: 25px;
    margin-bottom: 15px;
}

#reportContent h4 {
    color: #495057;
    margin-top: 20px;
    margin-bottom: 10px;
}

#reportContent table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    background: white;
}

#reportContent th,
#reportContent td {
    padding: 12px;
    border: 1px solid #dee2e6;
    text-align: left;
}

#reportContent th {
    background: #667eea;
    color: white;
    font-weight: 600;
}

#reportContent tr:nth-child(even) {
    background: #f8f9fa;
}

/* Buttons */
.button-group {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }

    .progress-bar {
        padding: 20px 10px;
    }

    .step-label {
        font-size: 0.7em;
    }

    .step-content {
        padding: 20px;
    }

    .risk-inputs {
        grid-template-columns: 1fr;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .checkbox-group {
        grid-template-columns: 1fr;
    }

    .hazard-list {
        grid-template-columns: 1fr;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
        margin: 0;
    }

    .container {
        box-shadow: none;
        max-width: 100%;
        padding: 0;
    }

    /* Hide everything except step 6 (report) */
    header,
    .progress-bar,
    .button-group,
    .description,
    #step1,
    #step2,
    #step3,
    #step4,
    #step5 {
        display: none !important;
    }

    /* Only show step 6 (the report) */
    #step6 {
        display: block !important;
        page-break-after: auto;
        padding: 20mm;
    }

    /* Ensure report content is visible */
    #step6 h2 {
        display: none; /* Hide "Step 6: Risk Assessment Report" heading */
    }

    /* A4 page sizing */
    @page {
        size: A4;
        margin: 15mm;
    }

    /* Better table formatting for print */
    table {
        width: 100%;
        page-break-inside: auto;
        border-collapse: collapse;
        margin-bottom: 20px;
    }

    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    thead {
        display: table-header-group;
    }

    tbody {
        display: table-row-group;
    }

    th, td {
        padding: 8px;
        border: 1px solid #333;
        text-align: left;
        font-size: 10pt;
    }

    th {
        background-color: #f0f0f0 !important;
        font-weight: bold;
    }

    /* Headings */
    h1 {
        font-size: 20pt;
        margin-bottom: 10px;
        page-break-after: avoid;
    }

    h2 {
        font-size: 16pt;
        margin-top: 15px;
        margin-bottom: 10px;
        page-break-after: avoid;
    }

    h3 {
        font-size: 14pt;
        margin-top: 12px;
        margin-bottom: 8px;
        page-break-after: avoid;
        color: #333;
    }

    h4 {
        font-size: 12pt;
        margin-top: 10px;
        margin-bottom: 6px;
        page-break-after: avoid;
    }

    /* Avoid breaking between heading and content */
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }

    /* Paragraph formatting */
    p {
        font-size: 10pt;
        margin: 8px 0;
        line-height: 1.4;
    }

    /* Risk badges should print with borders for clarity */
    .risk-badge {
        border: 1px solid #333;
        padding: 2px 8px;
        border-radius: 3px;
        font-weight: bold;
        display: inline-block;
    }

    .risk-badge.low {
        background-color: #d4edda !important;
        color: #155724 !important;
    }

    .risk-badge.medium {
        background-color: #fff3cd !important;
        color: #856404 !important;
    }

    .risk-badge.high {
        background-color: #f8d7da !important;
        color: #721c24 !important;
    }

    .risk-badge.very-high {
        background-color: #f5c6cb !important;
        color: #721c24 !important;
    }

    /* Avoid orphans and widows */
    p, li {
        orphans: 3;
        widows: 3;
    }

    /* Keep related content together */
    .risk-item,
    .hazard-category {
        page-break-inside: avoid;
    }
}
/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-height: 90vh;
    overflow-y: auto;
    max-width: 700px;
    width: 100%;
}

.modal-content.modal-lg {
    max-width: 900px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid #dee2e6;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2em;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    opacity: 0.8;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #dee2e6;
    background: #f8f9fa;
}

.modal-footer-note {
    font-size: 0.9em;
    color: #667eea;
    margin: 0;
    padding: 8px 12px;
    background: #e8ebff;
    border-radius: 6px;
    text-align: center;
}

.modal-footer .btn {
    margin: 0;
}

.modal-footer > div {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-footer > button {
    flex: 0 0 auto;
}

/* AI Review Content Styles */
.ai-review-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #dee2e6;
}

.ai-review-section:last-child {
    border-bottom: none;
}

.ai-review-section h3 {
    color: #667eea;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.ai-hazard-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 10px;
    border-left: 4px solid #667eea;
}

.ai-hazard-item h4 {
    margin: 0 0 10px 0;
    color: #333;
}

.ai-hazard-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 0.95em;
}

.ai-hazard-detail-item {
    display: flex;
    justify-content: space-between;
}

.ai-hazard-detail-label {
    font-weight: bold;
    color: #666;
}

.ai-measures {
    background: white;
    padding: 10px;
    margin-top: 10px;
    font-size: 0.9em;
    line-height: 1.6;
    white-space: pre-wrap;
    border-radius: 3px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay p {
    color: white;
    font-size: 1.1em;
    margin: 0;
}

/* Modern Dark Mode Theme */
body {
    background: radial-gradient(1200px 800px at 20% 10%, #111827 0%, #0b0f1a 55%, #05070f 100%);
    color: #e5e7eb;
}

.container {
    background: #0f172a;
    box-shadow: 0 20px 50px rgba(2, 6, 23, 0.6);
    border: 1px solid #1f2937;
}

header {
    background: linear-gradient(135deg, #0b1220 0%, #111827 100%);
}

.progress-bar {
    background: #0b1220;
    border-bottom: 1px solid #1f2937;
}

.progress-step::after {
    background: #1f2937;
}

.progress-step.completed::after {
    background: #22c55e;
}

.step-number {
    background: #1f2937;
    color: #cbd5f5;
}

.progress-step.active .step-number {
    background: #38bdf8;
    color: #0b1220;
}

.progress-step.completed .step-number {
    background: #22c55e;
    color: #0b1220;
}

.step-label {
    color: #cbd5f5;
}

.step-content h2 {
    color: #e2e8f0;
}

.description {
    color: #94a3b8;
}

.ai-help {
    font-size: 0.9em;
    color: #94a3b8;
    margin-bottom: 10px;
}

.form-group label {
    color: #e2e8f0;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group textarea,
.risk-input-group select,
.risk-input-group textarea {
    background: #0b1220;
    border: 1px solid #243142;
    color: #e5e7eb;
}

.form-group input[type="text"]::placeholder,
.form-group textarea::placeholder,
.risk-input-group textarea::placeholder {
    color: #94a3b8;
}

.form-group input[type="text"]:focus,
.form-group input[type="date"]:focus,
.form-group textarea:focus,
.risk-input-group select:focus,
.risk-input-group textarea:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.hazard-category,
.risk-card,
.risk-matrix-legend,
.risk-reduction-hierarchy {
    background: #0b1220;
    border: 1px solid #1f2937;
}

.hazard-category h3,
.risk-card h4,
.risk-matrix-legend h3 {
    color: #e2e8f0;
}

.hazard-list label {
    background: #111827;
    border: 1px solid #1f2937;
    color: #e5e7eb;
}

.hazard-list label:hover {
    background: #1f2937;
}

.hazard-checkbox {
    accent-color: #38bdf8;
}

.risk-level {
    color: #e5e7eb;
}

#reportContent table {
    background: #0b1220;
    border: 1px solid #1f2937;
}

#reportContent th {
    background: #111827;
}

#reportContent tr:nth-child(even) {
    background: #0f172a;
}

.modal {
    background: rgba(2, 6, 23, 0.8);
}

.modal-content {
    background: #0f172a;
    color: #e5e7eb;
    border: 1px solid #1f2937;
}

.modal-header {
    border-bottom: 1px solid #1f2937;
}

.modal-close {
    color: #94a3b8;
}

.modal-close:hover {
    color: #e2e8f0;
}

.ai-hazard-item {
    background: #0b1220;
    border: 1px solid #1f2937;
}

.ai-hazard-detail-label {
    color: #cbd5f5;
}

.ai-measures {
    background: #111827;
    color: #e5e7eb;
}

/* Buttons - Dark Mode */
.btn {
    border: 1px solid #334155;
    color: #e2e8f0;
    background: #1f2937;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
}

.btn:hover {
    box-shadow: 0 10px 25px rgba(2, 6, 23, 0.5);
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    border-color: #1d4ed8;
}

.btn-secondary {
    background: linear-gradient(135deg, #334155, #475569);
    border-color: #334155;
}

.btn-success {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    border-color: #15803d;
}

.btn-info {
    background: linear-gradient(135deg, #0ea5e9, #22d3ee);
    border-color: #0284c7;
    color: #001018;
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    border-color: #d97706;
    color: #1f2937;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #f97316);
    border-color: #dc2626;
}

/* Animated Glow for AI Button */
.ai-glow {
    position: relative;
    border: 2px solid #38bdf8;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.6), 
                inset 0 0 20px rgba(56, 189, 248, 0.1);
    animation: aiGlowBreathe 2.5s ease-in-out infinite;
}

@keyframes aiGlowBreathe {
    0%, 100% {
        box-shadow: 0 0 20px rgba(56, 189, 248, 0.6), 
                    inset 0 0 20px rgba(56, 189, 248, 0.1);
    }
    50% {
        box-shadow: 0 0 30px rgba(56, 189, 248, 0.8), 
                    inset 0 0 20px rgba(56, 189, 248, 0.2);
    }
}
/* Tool sub-navigation (back to suite home) */
.tool-nav {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 30px;
    background: #0b1220;
    border-bottom: 1px solid #1f2937;
    font-size: 0.9em;
}

.tool-nav-back {
    color: #38bdf8;
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}

.tool-nav-back:hover {
    text-decoration: underline;
}

.tool-nav-brand {
    font-weight: 700;
    color: #e2e8f0;
    letter-spacing: 0.02em;
}

.tool-nav-suffix {
    font-weight: 400;
    color: #94a3b8;
}

.tool-nav-badge {
    margin-left: auto;
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.5);
    color: #86efac;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.8em;
    font-weight: 600;
    white-space: nowrap;
}
/* Global helper (used by auth, cloud panel, and dialogs) */
.hidden {
    display: none !important;
}

/* Header auth (top-right buttons) */
.header-top {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 5px;
}

.auth-bar {
    background: none;
    padding: 0;
}

.auth-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.auth-row input {
    padding: 12px;
    background: #0b1220;
    border: 1px solid #243142;
    border-radius: 5px;
    color: #e5e7eb;
    font-size: 1em;
    font-family: inherit;
    transition: border-color 0.3s;
}

.auth-row input::placeholder {
    color: #94a3b8;
}

.auth-row input:focus {
    outline: none;
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

#cloudTitle {
    flex: 1;
    min-width: 200px;
}

.btn-auth-login,
.btn-auth-register {
    padding: 8px 20px;
    font-size: 0.9em;
    font-weight: 600;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn-auth-login {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.8);
    color: white;
}

.btn-auth-login:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-auth-register {
    background: white;
    border: 2px solid white;
    color: #667eea;
}

.btn-auth-register:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.auth-email {
    font-weight: 600;
    color: white;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.9em;
}

/* Login / register dialog */
.modal-content.modal-sm {
    max-width: 420px;
}

.auth-field {
    margin-bottom: 15px;
}

.auth-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.9em;
}

.auth-field input {
    width: 100%;
    padding: 10px 12px;
    background: #0b1220;
    border: 1px solid #243142;
    border-radius: 6px;
    color: #e5e7eb;
    font-size: 1em;
    box-sizing: border-box;
}

.auth-field input:focus {
    outline: none;
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.btn-block {
    width: 100%;
    padding: 12px;
    font-size: 1em;
}

.auth-error {
    color: #fca5a5;
    font-size: 0.9em;
    margin: 0 0 12px 0;
}

.auth-info {
    color: #93c5fd;
    font-size: 0.9em;
    margin: 0 0 12px 0;
}

.auth-switch {
    text-align: center;
    margin-top: 15px;
    font-size: 0.9em;
    color: #94a3b8;
}

.auth-switch a {
    color: #38bdf8;
    font-weight: 600;
}

.btn-small {
    padding: 8px 14px;
    font-size: 0.85em;
}

.cloud-panel {
    background: #0b1220;
    border: 1px solid #1f2937;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
}

.cloud-panel h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #e2e8f0;
    font-size: 1.2em;
}

.cloud-muted {
    color: #94a3b8;
    font-size: 1em;
    margin-bottom: 15px;
}

.cloud-muted a { color: #38bdf8; }

.cloud-error {
    color: #fca5a5;
}

.cloud-list {
    list-style: none;
    padding: 0;
    margin: 15px 0 0 0;
}

.cloud-item {
    display: flex;
    gap: 10px;
    align-items: center;
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 5px;
    padding: 10px 15px;
    margin-bottom: 10px;
    color: #e5e7eb;
}

.cloud-item span {
    flex: 1;
}

.cloud-current {
    border-color: #38bdf8;
}

.cloud-current span {
    font-weight: 600;
}

/* ---------- Cloud-only auth gate ---------- */
.auth-gate {
    background: #0b1220;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
}
.auth-gate-inner {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    color: #e2e8f0;
}
.auth-gate-inner span { color: #94a3b8; flex: 1 1 220px; }
.container.cloud-locked .step-content,
.container.cloud-locked .ehsr-progress {
    opacity: 0.55;
}

/* ---------- EHSR Compliance Checklist tool ---------- */
.ehsr-progress {
    background: #0b1220;
    border: 1px solid #1f2937;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
}

.ehsr-progress-bar {
    height: 10px;
    background: #1f2937;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 10px;
}

.ehsr-progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #2563eb, #38bdf8);
    border-radius: 999px;
    transition: width 0.3s ease;
}

.ehsr-progress-text {
    display: flex;
    gap: 14px;
    align-items: baseline;
    flex-wrap: wrap;
    font-size: 0.9em;
    color: #94a3b8;
}

.ehsr-progress-text strong {
    color: #e2e8f0;
    font-size: 1.1em;
}

.ehsr-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.ehsr-filters input[type="text"] {
    flex: 1;
    min-width: 200px;
    padding: 12px;
    background: #0b1220;
    border: 1px solid #243142;
    border-radius: 5px;
    color: #e5e7eb;
    font-size: 1em;
    font-family: inherit;
}

.ehsr-filters input[type="text"]::placeholder {
    color: #94a3b8;
}

.ehsr-filters input[type="text"]:focus {
    outline: none;
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.ehsr-filters select {
    padding: 12px;
    background: #0b1220;
    border: 1px solid #243142;
    border-radius: 5px;
    color: #e5e7eb;
    font-size: 1em;
    cursor: pointer;
    font-family: inherit;
}

.ehsr-group-header {
    color: #e2e8f0;
    margin: 28px 0 14px 0;
    font-size: 1.2em;
    padding-bottom: 8px;
    border-bottom: 2px solid #1f2937;
}

.ehsr-card {
    background: #0b1220;
    border: 1px solid #1f2937;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}

.ehsr-card-head {
    display: flex;
    gap: 16px;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
}

.ehsr-ref {
    display: inline-block;
    font-size: 0.78em;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #38bdf8;
    margin-bottom: 6px;
}

.ehsr-card-head h4 {
    color: #e2e8f0;
    margin: 0 0 8px 0;
    font-size: 1.1em;
}

.ehsr-summary {
    color: #cbd5f5;
    font-size: 0.93em;
    margin-bottom: 6px;
}

.ehsr-refs {
    color: #94a3b8;
    font-size: 0.82em;
}

.status-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.82em;
    white-space: nowrap;
    border: 1px solid transparent;
}

.status-badge.undecided {
    background: #1f2937;
    color: #cbd5f5;
    border-color: #334155;
}

.status-badge.attention {
    background: #fff3cd;
    color: #856404;
}

.status-badge.na {
    background: #e0e7ff;
    color: #3730a3;
}

.status-badge.complied {
    background: #d4edda;
    color: #155724;
}

.status-badge.partial {
    background: #fff3cd;
    color: #856404;
}

.status-badge.outstanding {
    background: #f8d7da;
    color: #721c24;
}

/* Technical File RAG overview table */
.tf-table-wrap {
    overflow-x: auto;
    margin: 14px 0 20px;
}

.tf-status-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    color: #1f2937;
    font-size: 0.95em;
}

.tf-status-table th,
.tf-status-table td {
    padding: 10px 12px;
    border: 1px solid #dee2e6;
    text-align: left;
    vertical-align: top;
}

.tf-status-table th {
    background: #667eea;
    color: white;
    font-weight: 600;
    white-space: nowrap;
}

.tf-status-table td:nth-child(2) {
    white-space: nowrap;
}

.tf-status-table a {
    color: #1d4ed8;
    font-weight: 600;
}

.tf-row-complete {
    background: #e6f4ea;
}

.tf-row-partial {
    background: #fef6e0;
}

.tf-row-missing {
    background: #fdecea;
}

@media (max-width: 640px) {
    .tf-status-table th,
    .tf-status-table td {
        padding: 8px;
        font-size: 0.85em;
    }
}

.ehsr-applic {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    padding: 12px 14px;
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 5px;
    margin-bottom: 14px;
}

.ehsr-field-label {
    font-weight: 600;
    color: #e2e8f0;
    font-size: 0.92em;
}

.ehsr-applic label {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #e5e7eb;
    cursor: pointer;
    font-weight: normal;
}

.ehsr-applic input[type="radio"] {
    accent-color: #38bdf8;
    cursor: pointer;
}

.ehsr-compliance-row select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ehsr-card .risk-input-group {
    margin-bottom: 14px;
}

.ehsr-card .risk-input-group:last-of-type {
    margin-bottom: 8px;
}

.ehsr-card .risk-input-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #e2e8f0;
    font-size: 0.92em;
    display: block;
}

.ehsr-card .risk-input-group select,
.ehsr-card .risk-input-group textarea {
    width: 100%;
    padding: 10px;
    background: #0b1220;
    border: 1px solid #243142;
    border-radius: 5px;
    color: #e5e7eb;
    font-size: 0.95em;
    font-family: inherit;
}

.ehsr-card .risk-input-group select:focus,
.ehsr-card .risk-input-group textarea:focus {
    outline: none;
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

@media print {
    /* EHSR tool: print only the report section */
    #ehsrChecklist .step-content:not(#ehsrReportSection),
    #ehsrReportSection h2,
    #ehsrReportSection .description,
    #ehsrReportSection .button-group,
    .ehsr-noprint {
        display: none !important;
    }

    #ehsrReportSection {
        display: block !important;
        padding: 20mm;
    }

    #ehsrReportContent {
        background: white !important;
        color: #333;
    }

    #ehsrReportContent table {
        background: white !important;
    }

    #ehsrReportContent th {
        background-color: #f0f0f0 !important;
        color: #333 !important;
    }

    #ehsrReportContent td {
        color: #333;
    }

    #ehsrReportContent h1,
    #ehsrReportContent h3,
    #ehsrReportContent p {
        color: #333 !important;
    }
}

/* ---------- EHSR guidance dialogue ---------- */
.ehsr-guide-row {
    margin-bottom: 14px;
}

.guide-list {
    margin: 0 0 0 20px;
    display: grid;
    gap: 8px;
    color: #e5e7eb;
    font-size: 0.93em;
}

.guide-list li::marker {
    color: #38bdf8;
}

.guide-fulfilment {
    color: #e5e7eb;
    font-size: 0.95em;
    line-height: 1.7;
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 5px;
    padding: 14px 16px;
}

.guide-disclaimer {
    font-size: 0.82em;
    background: #e8ebff;
    border-radius: 6px;
    padding: 8px 12px;
    margin-top: 18px;
    color: #475569;
}

/* ---------- Machine-centric workflow ---------- */
.machine-banner {
    background: #0b1220;
    border-bottom: 1px solid #1f2937;
    color: #e5e7eb;
    padding: 12px 30px;
}

.machine-banner-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.92em;
}

.machine-banner a { color: #38bdf8; }
.machine-banner-dim { color: #94a3b8; }
.machine-banner-status {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 10px;
    border-radius: 999px;
    background: #1f2937;
    color: #e2e8f0;
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.machine-banner-links { white-space: nowrap; }

.machine-locked {
    background: #111827 !important;
    border-color: #1f2937 !important;
    color: #94a3b8 !important;
    cursor: not-allowed;
}

.machine-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.machine-card {
    background: #0b1220;
    border: 1px solid #1f2937;
    border-radius: 8px;
    padding: 18px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.machine-card:hover {
    transform: translateY(-2px);
    border-color: #243142;
    box-shadow: 0 20px 50px rgba(2, 6, 23, 0.6);
}

.machine-card.current { border-color: #38bdf8; }

.machine-card h3 { margin: 0 0 6px 0; color: #e2e8f0; }
.machine-card-meta { color: #94a3b8; font-size: 0.88em; margin-bottom: 10px; }
.machine-card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.machine-progress { font-size: 0.85em; color: #94a3b8; margin-top: 8px; }
.machine-progress-bar { height: 8px; background: #1f2937; border-radius: 999px; overflow: hidden; margin-top: 6px; }
.machine-progress-fill { height: 100%; background: linear-gradient(135deg, #2563eb, #38bdf8); }

.resume-bar { margin-top: 16px; }
.resume-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: #0e1a2e;
    border: 1px solid #38bdf8;
    border-radius: 8px;
    padding: 12px 16px;
    color: #e2e8f0;
    font-size: 0.92em;
}

/* Machine-owned identity fields shown on assessment step 1 */
input[type="date"] { color-scheme: dark; }
.form-group select {
    width: 100%;
    padding: 12px;
    background: #0b1220;
    border: 1px solid #243142;
    border-radius: 5px;
    color: #e5e7eb;
    font-size: 1em;
    font-family: inherit;
    cursor: pointer;
}
.form-group select:focus {
    outline: none;
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

/* ---------- Evidence file attachments ---------- */
.attach-group {
    background: #0f172a;
    border: 1px dashed #334155;
    border-radius: 6px;
    padding: 12px;
}
.attach-hint { font-weight: 400; color: #94a3b8; font-size: 0.85em; }
.attach-empty { color: #94a3b8; font-size: 0.88em; margin: 4px 0; }
.attach-list { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; }
.attach-item {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    background: #0b1220; border: 1px solid #1f2937; border-radius: 5px;
    padding: 6px 10px; font-size: 0.88em;
}
.attach-name { color: #e2e8f0; font-weight: 600; overflow-wrap: anywhere; flex: 1 1 auto; }
.attach-meta { color: #94a3b8; }
.attach-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.attach-input { color: #cbd5e1; font-size: 0.88em; max-width: 100%; }
.attach-input:disabled { opacity: 0.5; cursor: not-allowed; }
.attach-status { font-size: 0.85em; color: #94a3b8; }
.attach-status.attach-error { color: #f87171; }
.attach-manifest { margin-top: 8px; }
.attach-manifest table { width: 100%; }
