:root {
    --hse-green: #176b52;
    --hse-dark: #162821;
    --hse-bg: #f3f6f4;
}

body {
    background: var(--hse-bg);
}

.navbar {
    box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .12);
}

.bg-hse {
    background: var(--hse-dark);
}

.btn-hse {
    color: #fff;
    background: var(--hse-green);
    border-color: var(--hse-green);
}

.btn-hse:hover {
    color: #fff;
    background: #11523f;
    border-color: #11523f;
}

.language-floating {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 20;
    min-width: 3.25rem;
}

.auth-shell {
    min-height: calc(100vh - 3rem);
    display: grid;
    place-items: center;
    background:
        linear-gradient(rgba(22, 40, 33, 0.78), rgba(22, 40, 33, 0.78)),
        url("/static/construction-safety-hero.png") center/cover;
    margin: -1rem;
    padding: 2rem;
}

.auth-card {
    width: min(460px, 100%);
    background: #fff;
    border-radius: .75rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, .22);
    padding: 2rem;
}

.stat-card {
    min-height: 118px;
    border-radius: 1rem;
    transition: transform .15s ease, box-shadow .15s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 1rem 2rem rgba(22, 40, 33, .12) !important;
}

.risk-critical {
    background: #dc3545;
}

.risk-high {
    color: #2b1700;
    background: #fd7e14;
}

.risk-medium {
    color: #2b2700;
    background: #ffc107;
}

.risk-low {
    background: #198754;
}

.status-open {
    background: #dc3545;
}

.status-in-progress {
    color: #2b2700;
    background: #ffc107;
}

.status-closed,
.status-completed {
    background: #198754;
}

.preview-image,
.detail-photo {
    width: 100%;
    max-height: 280px;
    object-fit: cover;
    border-radius: .5rem;
    border: 1px solid #dee2e6;
}

.empty-photo {
    display: grid;
    min-height: 180px;
    place-items: center;
    color: #6c757d;
    border: 1px dashed #ced4da;
    border-radius: .5rem;
    background: #f8f9fa;
}

.comparison-card {
    padding: 1rem;
    border: 1px solid #e4e9e6;
    border-radius: .9rem;
    background: #f8fbf9;
}

.before-after-comparison {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    border-radius: .75rem;
    background: #e9ecef;
}

.comparison-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.comparison-before {
    position: absolute;
    inset: 0;
    width: 50%;
    overflow: hidden;
    border-right: 3px solid #fff;
    box-shadow: .35rem 0 1rem rgba(0, 0, 0, .18);
}

.comparison-before .comparison-img {
    width: calc(100% / .5);
    max-width: none;
}

.comparison-label {
    position: absolute;
    top: .75rem;
    padding: .3rem .65rem;
    color: #fff;
    border-radius: 999px;
    background: rgba(22, 40, 33, .82);
    font-size: .8rem;
    font-weight: 700;
}

.before-label {
    left: .75rem;
}

.after-label {
    right: .75rem;
}

.photo-panel,
.corrective-action {
    padding: 1rem;
    border: 1px solid #e4e9e6;
    border-radius: .75rem;
    background: #fff;
}

.detail-list dt {
    color: #5f6f68;
}

.timeline {
    position: relative;
    padding-left: 1.25rem;
}

.timeline::before {
    position: absolute;
    top: .25rem;
    bottom: .25rem;
    left: .25rem;
    width: 2px;
    content: "";
    background: #d7e3de;
}

.timeline-item {
    position: relative;
    padding-left: .75rem;
    padding-bottom: 1rem;
}

.timeline-dot {
    position: absolute;
    top: .25rem;
    left: -1.22rem;
    width: .7rem;
    height: .7rem;
    border: 2px solid #fff;
    border-radius: 999px;
    background: var(--hse-green);
    box-shadow: 0 0 0 2px var(--hse-green);
}

.profile-avatar {
    display: grid;
    width: 72px;
    height: 72px;
    place-items: center;
    color: #fff;
    border-radius: 999px;
    background: var(--hse-green);
    font-size: 2rem;
}

.empty-state {
    padding: 2rem;
    text-align: center;
    border: 1px dashed #cbd8d2;
    border-radius: 1rem;
    background: #fff;
}

.empty-icon {
    display: grid;
    width: 76px;
    height: 76px;
    margin: 0 auto 1rem;
    place-items: center;
    color: var(--hse-green);
    border-radius: 999px;
    background: #e8f3ef;
    font-size: 2.2rem;
}

@media (max-width: 576px) {
    .display-6 {
        font-size: 1.8rem;
    }
}

/* HSE-007 field workflow: responsive cards, evidence and practical touch targets. */
.navbar-user { display: flex; align-items: center; gap: .5rem; }
.navbar-user form { margin: 0; }
.field-form-shell { max-width: 960px; }
.mobile-observation-cards,
.mobile-action-cards { display: none; }
.mobile-card-details { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem 1rem; }
.mobile-card-details div { min-width: 0; }
.mobile-card-details dt { color: #66756f; font-size: .75rem; text-transform: uppercase; }
.mobile-card-details dd { margin: 0; overflow-wrap: anywhere; }
.observation-mobile-card,
.action-mobile-card { margin-bottom: .85rem; }
.evidence-label { margin-bottom: .4rem; color: #53645d; font-size: .8rem; font-weight: 700; text-transform: uppercase; }
.audit-value,
.timeline-item,
.corrective-action { overflow-wrap: anywhere; }
.status-assigned { background: #0d6efd; }
.status-pending-verification { color: #212529; background: #6edff6; }
.status-open, .status-assigned, .status-in-progress, .status-pending-verification,
.status-closed, .status-completed, .risk-low, .risk-medium, .risk-high, .risk-critical { white-space: normal; }

@media (max-width: 767.98px) {
    main.container-fluid { padding: 1rem !important; }
    .navbar-brand { max-width: calc(100vw - 76px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .navbar-collapse { padding: .5rem 0 1rem; }
    .navbar-nav .nav-link { display: flex; align-items: center; min-height: 44px; padding: .65rem .5rem; }
    .navbar-user { align-items: stretch; flex-wrap: wrap; }
    .navbar-user .navbar-text { flex-basis: 100%; }
    .navbar-user .btn { min-height: 44px; min-width: 64px; }
    .mobile-touch { min-width: 44px; min-height: 44px; }
    .page-heading { align-items: stretch !important; flex-direction: column; }
    .mobile-primary { width: 100%; }
    .desktop-observation-table,
    .desktop-actions-table { display: none; }
    .mobile-observation-cards,
    .mobile-action-cards { display: block; }
    .field-form .form-control,
    .field-form .form-select,
    .field-form .btn,
    .field-actions .btn,
    .corrective-action .form-control,
    .corrective-action .form-select,
    .corrective-action .btn { min-height: 44px; }
    .field-actions { flex-direction: column; }
    .field-actions .btn { width: 100%; }
    .photo-first-field { padding-bottom: .5rem; border-bottom: 1px solid #dee2e6; }
    .observation-detail-main { display: flex; flex-direction: column; }
    .evidence-card { order: 1; }
    .corrective-actions-card { order: 2; }
    .observation-details-card { order: 3; }
    .detail-photo, .preview-image { max-height: 60vh; object-fit: contain; background: #f8f9fa; }
    .comparison-card { padding: .65rem; }
    .comparison-card > .d-flex { align-items: flex-start !important; flex-direction: column; }
    .before-after-comparison { aspect-ratio: 4 / 3; }
    .mobile-upload-group { display: flex; gap: .5rem; flex-direction: column; }
    .mobile-upload-group > .form-control,
    .mobile-upload-group > .btn { width: 100%; border-radius: .375rem !important; }
    .verification-actions,
    .reject-action-form { align-items: stretch !important; flex-direction: column; }
    .verification-actions > form,
    .verification-actions .btn,
    .reject-action-form .form-control { width: 100%; }
    .corrective-action { padding: .85rem !important; }
    .detail-list dt { margin-top: .5rem; }
    .detail-list dd { margin-bottom: .25rem; }
}

@media (max-width: 359.98px) {
    .navbar-brand { font-size: 1rem; }
    .mobile-card-details { grid-template-columns: 1fr; }
    .card-body, .card-header { padding-left: .8rem; padding-right: .8rem; }
}

/* HSE-008 management dashboard: scoped responsive additions. */
.dashboard-kpis .kpi-card { border-left: 4px solid #198754 !important; }
.dashboard-kpis .kpi-card:hover { transform: translateY(-1px); }
.dashboard-chart { position: relative; min-height: 220px; max-height: 260px; }
.dashboard-list-row { display: flex; flex-direction: column; padding: .65rem 0; color: inherit; text-decoration: none; border-bottom: 1px solid #e6ebe8; overflow-wrap: anywhere; }
.dashboard-list-row span { color: #66756f; font-size: .85rem; }
.dashboard-table { max-width: 100%; }
@media (max-width: 767.98px) {
    .dashboard-kpis .display-6 { font-size: 1.8rem; }
    .dashboard-kpis .card-body { padding: .85rem; }
    .dashboard-chart { min-height: 190px; }
    .dashboard-filters .btn, .dashboard-filters .form-select { min-height: 44px; }
}

/* HSE-009 reports: scoped screen, responsive, and print presentation. */
.report-page { overflow-wrap: anywhere; }
.report-register th, .report-register td { min-width: 105px; white-space: normal; }
.report-register th:nth-child(2), .report-register td:nth-child(2) { min-width: 190px; }
.report-brand { padding: 1.25rem; color: #fff; border-left: 7px solid #e0a800; background: #165b3b; }
.brand-slot { min-height: 1.25rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.report-section { margin-bottom: 1.25rem; padding: 1.25rem; border: 1px solid #d8e2dd; border-radius: .65rem; background: #fff; }
.report-section > h2 { padding-bottom: .4rem; color: #165b3b; border-bottom: 2px solid #dcebe4; font-size: 1.25rem; }
.report-meta { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .65rem 1.5rem; }
.report-meta div { display: grid; grid-template-columns: 130px minmax(0,1fr); }
.report-meta dt { color: #607068; }
.report-meta dd { margin: 0; font-weight: 600; }
.report-action-block { margin-top: 1rem; padding: 1rem; border-left: 4px solid #198754; background: #f8fbf9; break-inside: avoid; }
.evidence-block { margin-top: 1rem; break-inside: avoid; }
.evidence-block h3 { color: #165b3b; font-size: .85rem; letter-spacing: .12em; }
.evidence-block img { display: block; width: auto; height: auto; max-width: 100%; max-height: 520px; object-fit: contain; border: 1px solid #d8e2dd; }
.evidence-missing { padding: 2rem; color: #68756f; border: 1px dashed #aebdb6; text-align: center; }
.report-long-text { white-space: pre-wrap; }
.report-history li { margin-bottom: .75rem; }
.report-history span { color: #64736c; font-size: .9rem; }
@media (max-width: 767.98px) {
 .report-heading, .report-action { width: 100%; }
 .report-filters .btn, .report-filters .form-select, .report-filters .form-control { min-height: 44px; }
 .report-meta { grid-template-columns: 1fr; }
 .report-meta div { grid-template-columns: 110px minmax(0,1fr); }
 .report-section { padding: .85rem; }
}
@media print {
 body { color: #111; background: #fff; font-size: 10pt; }
 nav, footer, .no-print { display: none !important; }
 main.container-fluid { max-width: none; padding: 0 !important; }
 .report-page { width: 100%; }
 .report-brand { color: #111; border: 0; border-bottom: 3px solid #165b3b; background: #fff; }
 .report-section { padding: 8pt 0; border: 0; box-shadow: none; }
 .report-action-block, .evidence-block { break-inside: avoid; }
 .evidence-block img { max-height: 90mm; }
 .report-register { overflow: visible; }
 .report-register table { font-size: 8pt; }
 .report-summary .card { border: 1px solid #ccc !important; box-shadow: none !important; }
 @page { size: A4; margin: 14mm; }
}
/* HSE-010 centralized locale selector and direction-aware layout. */
.language-selector { display:flex; gap:.25rem; align-items:center; }
.language-selector form { margin:0; }
.language-floating { position:fixed; inset-block-start:1rem; inset-inline-end:1rem; z-index:20; }
.nav-primary { margin-inline-end:auto; }
.icon-space { margin-inline-end:.5rem; }
[dir="rtl"] body { text-align:start; }
[dir="rtl"] .navbar-nav, [dir="rtl"] .navbar-user { padding-inline-start:0; }
[dir="rtl"] .text-md-end { text-align:end !important; }
[dir="rtl"] input[type="date"], [dir="rtl"] .user-identity, [dir="rtl"] code { direction:ltr; unicode-bidi:embed; }
[dir="rtl"] img, [dir="rtl"] .comparison-img { transform:none; }
@media (max-width: 991.98px) { .language-selector .btn { min-height:44px; min-width:44px; } }
