* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
}

.hidden { display: none !important; }

.toolbar-filter-input {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.875rem;
}

.missing-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #fee;
    color: #c33;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: help;
}

.complete-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #efe;
    color: #3c3;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
}

.missing-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #fee;
    color: #c33;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: help;
}

.complete-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #efe;
    color: #3c3;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
}

.missing-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #fee;
    color: #c33;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: help;
}

.complete-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #efe;
    color: #3c3;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
}

.toolbar-inline-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.875rem;
}

.user-status-filters {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.user-status-filters input[type="checkbox"] {
    margin: 0;
}

.header-inline-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.twofa-message {
    margin-bottom: 1rem;
    color: #374151;
}

.btn-muted {
    margin-top: 0.5rem !important;
    background: #e5e7eb !important;
    color: #111827 !important;
}

.btn-muted:hover {
    background: #e5e7eb !important;
    color: #111827 !important;
}

.ui-lang-indicator-login {
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
    color: #374151;
    background: #f3f4f6;
    border-radius: 4px;
    padding: 4px 8px;
}

.ui-lang-indicator-main {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #1f2937;
    background: #e5e7eb;
}

.ui-lang-indicator-visible {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.lang-flag-sm {
    width: 18px;
    height: 12px;
    object-fit: cover;
    border: 1px solid #d1d5db;
    border-radius: 2px;
}

.lang-code-strong {
    font-weight: 600;
}

.language-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: help;
}

.language-badge-code {
    font-size: 0.75rem;
    font-weight: 600;
    color: #374151;
}

.inline-icon-svg {
    vertical-align: middle;
}

.status-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    color: white;
    font-size: 12px;
    font-weight: bold;
    cursor: help;
}

.status-dot-neutral {
    background: #6b7280;
}

.status-dot-danger {
    background: #dc2626;
}

.status-dot-warning {
    background: #f59e0b;
}

.status-dot-success {
    background: #15803d;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 84px;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.status-badge-ok {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.status-badge-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

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

.service-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 0.9rem;
    margin-top: 0.9rem;
}

.service-traffic-strip {
    margin-top: 0.8rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.55rem;
}

.service-traffic-pill {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
    border-radius: 9px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    padding: 0.45rem 0.6rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.service-traffic-pill-label {
    font-size: 0.72rem;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 700;
}

.service-traffic-pill-value {
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.2;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.service-traffic-pill.ok {
    border-color: #86efac;
    background: #f0fdf4;
    color: #166534;
}

.service-traffic-pill.warn {
    border-color: #fcd34d;
    background: #fffbeb;
    color: #92400e;
}

.service-traffic-pill.danger {
    border-color: #fca5a5;
    background: #fef2f2;
    color: #991b1b;
}

.service-dashboard-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 0.85rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    margin-top: 0.9rem;
}

.service-dashboard-card h4 {
    margin-bottom: 0.65rem;
    color: #0f172a;
    font-size: 1rem;
}

.service-dashboard-table {
    box-shadow: none;
    border: 1px solid #e5e7eb;
}

.service-dashboard-table th,
.service-dashboard-table td {
    border-bottom: 1px solid #eef2f7;
    font-size: 0.92rem;
}

.service-dashboard-table th {
    background: #f8fafc;
    color: #0f172a;
    cursor: default;
}

.service-dashboard-table th:hover,
.service-dashboard-kv-table th:hover {
    background: #f8fafc;
}

.service-dashboard-kv-table {
    box-shadow: none;
    border: 1px solid #e5e7eb;
}

.service-dashboard-kv-table th,
.service-dashboard-kv-table td {
    border-bottom: 1px solid #eef2f7;
    padding: 0.62rem 0.78rem;
    font-size: 0.92rem;
}

.service-dashboard-kv-table th {
    width: 62%;
    background: #f8fafc;
    color: #334155;
    font-weight: 600;
    cursor: default;
}

.service-dashboard-kv-table td {
    color: #0f172a;
    background: #fff;
}

.text-center {
    text-align: center;
}

.sortable-header {
    cursor: pointer;
}

.text-alert-strong {
    color: #dc2626;
    font-weight: bold;
}

.text-success-strong {
    color: #16a34a;
    font-weight: bold;
}

.mark-ok,
.mark-bad {
    font-weight: bold;
    font-size: 1.2rem;
}

.mark-ok {
    color: #16a34a;
}

.mark-bad {
    color: #dc2626;
}

.case-row-alert {
    background: #fee2e2;
}

.case-row-stale {
    background: #fff7ed;
}

.location-row-orphan {
    background: #dcfce7;
}

.meta-pill-row {
    display: flex;
    gap: 2px;
}

.meta-pill {
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
}

.meta-pill-risk {
    background: #fee2e2;
    color: #991b1b;
}

.meta-pill-disability {
    background: #dcfce7;
    color: #166534;
}

.meta-pill-warning {
    background: #fef9c3;
    color: #854d0e;
}

.inline-code-pill {
    background: #f3f4f6;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
}

.inline-code-chip {
    background: #f3f4f6;
    padding: 2px 4px;
    border-radius: 4px;
}

.markdown-pre {
    background: #111827;
    color: #f9fafb;
    padding: 0.75rem;
    border-radius: 6px;
    overflow: auto;
}

.markdown-quote {
    border-left: 4px solid #d1d5db;
    margin: 0;
    padding: 0.25rem 0.75rem;
    color: #374151;
}

.markdown-viewer {
    max-height: 70vh;
    overflow: auto;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 1rem;
    background: #fff;
    line-height: 1.5;
    color: #111827;
}

.admin-photo-thumb {
    height: 50px;
    border-radius: 4px;
}

.case-note-snippet-cell {
    max-width: 460px;
}

.env-badge-login {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    color: white;
    text-align: center;
    margin-bottom: 1rem;
}

.env-badge-main {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    color: white;
}

.env-badge-theme-dev {
    background: #eab308;
}

.env-badge-theme-prod {
    background: #2563eb;
}

.env-badge-theme-uat {
    background: #3b82f6;
}

.env-badge-theme-default {
    background: #6b7280;
}

.section-gap-top {
    margin-top: 1rem;
}

.machine-translate-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-top: 0.5rem;
}

.machine-translate-controls label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.machine-translate-preview {
    margin-top: 0.75rem;
}

.machine-translate-preview table {
    width: 100%;
}

.machine-translate-preview th,
.machine-translate-preview td {
    font-size: 0.9rem;
}

.mt-3 {
    margin-top: 0.75rem;
}

.status-card-neutral {
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #f9fafb;
    color: #1f2937;
    font-size: 0.95rem;
}

.status-card-danger {
    padding: 0.75rem;
    border: 1px solid #fecaca;
    border-radius: 6px;
    background: #fef2f2;
    color: #7f1d1d;
    font-size: 0.95rem;
}

.status-card-warning {
    padding: 0.75rem;
    border: 1px solid #fde68a;
    border-radius: 6px;
    background: #fffbeb;
    color: #78350f;
    font-size: 0.95rem;
}

.status-card-slate {
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #f9fafb;
    color: #111827;
    font-size: 0.95rem;
}

.btn-danger {
    background: #b91c1c !important;
}

.btn-warning {
    background: #b45309 !important;
}

.btn-dark {
    background: #1f2937 !important;
}

.btn-blue {
    background: #2563eb !important;
    color: #fff !important;
}

.btn-slate {
    background: #4b5563 !important;
    color: #fff !important;
}

.btn-green {
    background: #059669 !important;
    color: #fff !important;
}

.btn-teal {
    background: #0f766e !important;
    color: #fff !important;
}

.info-panel {
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    color: #374151;
}

.vulcan-reconcile-status {
    margin-bottom: 0.75rem;
    padding: 0.65rem 0.8rem;
    border-left: 5px solid #1d70b8;
    background: #f3f2f1;
    color: #0b0c0c;
    font-weight: 600;
}

.vulcan-reconcile-status.ok {
    border-left-color: #00703c;
}

.vulcan-reconcile-status.warn {
    border-left-color: #f47738;
}

.vulcan-reconcile-status.error {
    border-left-color: #d4351c;
}

.vulcan-report-generated {
    margin-bottom: 0.75rem;
    color: #4b5563;
}

.vulcan-reconcile-toolbar {
    margin-bottom: 0.75rem;
}

.vulcan-reconcile-action-status {
    margin-bottom: 0.75rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid #b1b4b6;
    background: #f3f2f1;
    color: #0b0c0c;
}

.vulcan-reconcile-action-status.success {
    border-color: #00703c;
}

.vulcan-reconcile-action-status.error {
    border-color: #d4351c;
    color: #d4351c;
}

.vulcan-table-actions {
    white-space: nowrap;
}

.vulcan-table-actions .govuk-button {
    margin-right: 0.45rem;
}

.vulcan-table-actions .govuk-button:last-child {
    margin-right: 0;
}

.mb-4 {
    margin-bottom: 1rem;
}

.totp-step {
    margin-bottom: 0.75rem;
    color: #374151;
}

.totp-qr-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.totp-qr-image {
    max-width: 240px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

.totp-secret {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 0.75rem;
}

.totp-code-input {
    margin-top: 4px;
}

.modal-entry-card {
    border: 1px solid #e5e7eb;
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    background: #fafafa;
    position: relative;
}

.modal-entry-remove {
    position: absolute;
    right: 0.5rem;
    top: 0.5rem;
    padding: 2px 6px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 4px;
    border: none;
    cursor: pointer;
}

.modal-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.input-no-margin {
    margin: 0 !important;
}

.input-mb-2 {
    margin-bottom: 0.5rem !important;
}

.input-mt-2 {
    margin-top: 0.5rem !important;
}

.modal-mt-2 {
    margin-top: 0.5rem;
}

.photo-preview-thumb {
    max-width: 100%;
    height: 130px;
    object-fit: cover;
    border-radius: 2px;
}

.modal-mt-1 {
    margin-top: 4px;
}

.address-entry-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(220px, 1fr);
    gap: 0.75rem;
    align-items: start;
}

.address-entry-left {
    min-width: 0;
}

.address-entry-right {
    min-width: 0;
}

.address-entry-actions {
    margin-top: 0.55rem;
    display: flex;
    justify-content: flex-end;
}

.address-entry-remove-btn {
    padding: 0.32rem 0.62rem;
}

.address-postcode-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.45rem;
    align-items: center;
}

.address-geocode-wrap {
    border: 1px solid #dbeafe;
    background: #f8fbff;
    border-radius: 6px;
    padding: 0.55rem;
    margin-bottom: 0.55rem;
}

.address-geocode-toolbar {
    display: flex;
    gap: 0.45rem;
    align-items: center;
}

.address-geocode-toolbar .address-geocode-query {
    margin: 0;
}

.address-geocode-toolbar .address-geocode-search-btn {
    margin: 0;
    white-space: nowrap;
}

.address-geocode-hint {
    margin-top: 0.1rem;
    color: #475569;
    font-size: 0.78rem;
}

.address-geocode-results {
    margin-top: 0.45rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    max-height: 150px;
    overflow-y: auto;
}

.address-geocode-result-btn {
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 4px;
    text-align: left;
    cursor: pointer;
    padding: 0.4rem 0.5rem;
    font-size: 0.8rem;
}

.address-geocode-result-btn:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}

.address-mini-map {
    width: 100%;
    aspect-ratio: 1 / 1;
    min-height: 240px;
    border: 1px solid #bfdbfe;
    border-radius: 4px;
}

@media (max-width: 940px) {
    .address-entry-layout {
        grid-template-columns: 1fr;
    }

    .address-mini-map {
        min-height: 200px;
    }

    .address-postcode-row {
        grid-template-columns: 1fr;
    }
}

.modal-add-entry-btn {
    margin-top: 0.5rem !important;
    width: 100%;
}

.modal-textarea-lg {
    min-height: 120px;
}

.readonly-input {
    background: #f3f4f6;
    cursor: not-allowed;
}

.device-manual-input {
    margin-top: 4px;
}

.modal-file-input-mt {
    margin-top: 4px !important;
}

.image-preview-wrap {
    margin: 0.25rem 0 0.9rem 0;
}

.image-preview-logo {
    display: block;
    height: 88px;
    max-width: 260px;
    width: auto;
    object-fit: contain;
}

.modal-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    margin-top: 0.5rem;
}

.modal-checkbox-input {
    width: auto;
    margin: 0 !important;
}

.photo-entry-card {
    border: 1px solid #e5e7eb;
    padding: 0.5rem;
    border-radius: 4px;
    background: #fafafa;
    position: relative;
    text-align: center;
    display: inline-block;
    width: 170px;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.photo-entry-remove {
    position: absolute;
    right: 2px;
    top: 2px;
    padding: 0 4px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 10px;
}

.photo-entry-image {
    width: 100%;
    height: 130px;
    object-fit: cover;
    border-radius: 2px;
    display: block;
    margin-bottom: 2px;
    cursor: pointer;
}

.photo-entry-caption {
    font-size: 12px;
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-card {
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
}

.settings-card-mt {
    margin-top: 1rem;
}

.settings-card-title {
    font-weight: 600;
    color: #374151;
    display: block;
    margin-bottom: 0.5rem;
}

.settings-card-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.settings-card-row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.settings-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.settings-card-actions-inline {
    display: flex;
    gap: 0.5rem;
}

.settings-card-note {
    font-size: 0.75rem;
    color: #6b7280;
}

.settings-card-note-tight {
    margin: 0 0 0.5rem 0;
}

.settings-card-note-mt {
    margin-top: 0.5rem;
}

.badge-sm {
    font-size: 0.875rem;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-neutral {
    background: #f3f4f6;
    color: #374151;
}

.case-notes-panel {
    margin-top: 0.5rem;
}

.case-notes-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    gap: 0.5rem;
}

.case-notes-empty {
    padding: 0.5rem 0;
    color: #6b7280;
}

.case-note-card {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 0.75rem;
    background: #fafafa;
    margin-bottom: 0.75rem;
}

.case-note-header {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.case-note-meta {
    font-size: 0.8rem;
    color: #374151;
}

.case-note-badge-wrap {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.case-note-type-badge {
    font-size: 0.75rem;
    background: #e5e7eb;
    color: #111827;
}

.case-note-body {
    font-size: 0.875rem;
    color: #111827;
    line-height: 1.45;
}

.case-note-updated {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.case-notes-admin-actions {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Case Audit Timeline */
.case-timeline {
    position: relative;
    padding-left: 1.25rem;
    border-left: 2px solid #e5e7eb;
    margin-top: 0.5rem;
}

.case-timeline-empty {
    padding: 0.5rem 0;
    color: #6b7280;
}

.timeline-row {
    position: relative;
    padding-bottom: 1rem;
    margin-bottom: 0.25rem;
}

.timeline-row:last-child {
    padding-bottom: 0;
    margin-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -1.45rem;
    top: 0.35rem;
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    background: #9ca3af;
    border: 2px solid #fff;
}

.timeline-source-audit-log .timeline-marker { background: #2563eb; }
.timeline-source-case-note .timeline-marker { background: #059669; }
.timeline-source-device-audit-log .timeline-marker { background: #d97706; }

.timeline-body {
    background: #fafafa;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
}

.timeline-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    flex-wrap: wrap;
}

.timeline-time {
    font-size: 0.75rem;
    color: #6b7280;
}

.timeline-source-badge {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    background: #e5e7eb;
    color: #374151;
}

.timeline-source-audit-log .timeline-source-badge { background: #dbeafe; color: #1e40af; }
.timeline-source-case-note .timeline-source-badge { background: #d1fae5; color: #065f46; }
.timeline-source-device-audit-log .timeline-source-badge { background: #fef3c7; color: #92400e; }

.timeline-action {
    font-size: 0.875rem;
    color: #111827;
}

.timeline-detail {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: #4b5563;
    white-space: pre-wrap;
}

.view { min-height: 100vh; }

.org-logo-main {
    display: block;
    height: 48px;
    max-width: 160px;
    width: auto;
    object-fit: contain;
}

.org-logo-main-large {
    height: 88px;
    max-width: 260px;
    width: auto;
    object-fit: contain;
}

.user-name-clickable {
    cursor: pointer;
    text-decoration: none;
}

.password-warning {
    margin-top: -0.6rem;
    margin-bottom: 0.75rem;
    color: #dc2626;
    font-size: 0.8rem;
}

.password-strength-indicator {
    margin-top: 0.25rem;
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.password-strength-weak {
    color: #dc2626;
}

.password-strength-medium {
    color: #f59e0b;
}

.password-strength-strong {
    color: #16a34a;
}

.input-invalid {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.12) !important;
}

.required-indicator {
    color: #dc2626;
    font-weight: 700;
    margin-left: 0.15rem;
}

.modal-validation-message {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #991b1b;
    border-radius: 6px;
    padding: 0.55rem 0.7rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}

#login-view,
#twofa-view {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-box {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 300px;
}

.login-box h1 {
    margin-bottom: 1.5rem;
    text-align: center;
}

.modal-content .govuk-error-summary {
    margin-bottom: 1rem;
}

.modal-content .modal-field-error {
    margin: 0.35rem 0 0.45rem;
}

.login-box .govuk-form-group {
    margin-bottom: 0.75rem;
}

.login-box .govuk-error-summary {
    margin-bottom: 1rem;
}

.login-box .govuk-error-message {
    margin-bottom: 0.45rem;
}

.login-box input {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.login-box button {
    width: 100%;
    padding: 0.75rem;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.login-box button:hover { background: #1d4ed8; }

.error { color: #dc2626; margin-top: 0.5rem; text-align: center; }

#main-view header {
    background: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
}

.user-info { display: flex; gap: 1rem; align-items: center; }

#logout-btn {
    padding: 0.5rem 1rem;
    background: #6b7280;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* Navigation & Dropdowns */
nav {
    background: white;
    padding: 0 2rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-scroll-wrapper {
    display: flex;
    align-items: center;
}

.nav-group {
    position: relative;
    display: inline-block;
}

.nav-group-btn {
    padding: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-group-btn::after {
    content: '▾';
    font-size: 0.75rem;
}

.nav-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 200px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    border: 1px solid #e5e7eb;
    border-radius: 0 0 4px 4px;
    z-index: 1000;
    padding-top: 4px;
    margin-top: -4px;
}

.nav-group:hover .nav-dropdown {
    display: block;
}

.nav-group:focus-within .nav-dropdown {
    display: block;
}

.nav-group.is-open .nav-dropdown {
    display: block;
}

.nav-dropdown .tab-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: none;
}

.nav-dropdown .tab-btn:hover {
    background: #f3f4f6;
}

.nav-dropdown .reports-placeholder-btn {
    color: #505a5f;
    cursor: default;
}

.nav-dropdown .reports-placeholder-btn:hover {
    background: transparent;
}

.nav-dropdown .tab-btn.active {
    background: #eff6ff;
    color: #2563eb;
    border-left: 3px solid #2563eb;
}

.tab-btn {
    padding: 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    color: #374151;
}

.tab-btn.active {
    border-bottom-color: #2563eb;
    color: #2563eb;
}

.nav-link {
    padding: 1rem;
    color: #2563eb;
    text-decoration: none;
}

.push-right {
    margin-left: auto;
}

@media (max-width: 900px) {
    .org-logo-main {
        height: 40px;
        max-width: 130px;
    }
}


.tab-content {
    padding: 2rem;
    display: none;
}

.tab-content.active {
    display: block;
}

.toolbar { 
    margin-bottom: 1rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}


.toolbar button {
    padding: 0.5rem 1rem;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

table {
    width: 100%;
    background: white;
    border-collapse: collapse;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

th { 
    background: #f9fafb; 
    font-weight: 600; 
    cursor: pointer;
    user-select: none;
    position: relative;
}

th:hover { background: #f3f4f6; }

th .sort-icon {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    margin-left: 0.25rem;
    vertical-align: middle;
}

th.asc .sort-icon::after { content: '↑'; }
th.desc .sort-icon::after { content: '↓'; }

.cases-col-optional {
    display: none;
}

#cases-tab.cases-columns-expanded .cases-col-optional {
    display: table-cell;
}

td button {
    padding: 0.25rem 0.5rem;
    margin-right: 0.25rem;
    margin-bottom: 0.15rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
}

.edit-btn { background: #f59e0b; color: white; }
.delete-btn { background: #dc2626; color: white; }

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

/* Modal Tabs */
.modal-tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 1rem;
    gap: 1rem;
}

.modal-tabs-sticky {
    position: sticky;
    top: 0;
    z-index: 8;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem;
    background: #fff;
    padding: 0.35rem 0 0.35rem;
    margin-bottom: 0.9rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-tabs-scroll {
    margin-bottom: 0;
    border-bottom: none;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
    padding-bottom: 0.1rem;
}

.modal-tabs-save-btn {
    flex: 0 0 auto;
    background: #1d4ed8;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 0.46rem 0.82rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 0.05rem;
}

.modal-tabs-save-btn:hover {
    background: #1e40af;
}

.toolbar-help-text {
    font-size: 0.8rem;
    color: #4b5563;
}

.org-structure-toolbar {
    flex-wrap: wrap;
}

.org-structure-view-controls {
    display: inline-flex;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    overflow: hidden;
}

.org-structure-view-controls button {
    border-radius: 0;
    margin: 0;
    min-width: 2.2rem;
}

.org-structure-note {
    margin: 0 0 0.75rem;
    color: #4b5563;
    font-size: 0.9rem;
}

.org-structure-editor-canvas {
    position: relative;
    min-height: 540px;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    border: 1px solid #d1d5db;
    border-radius: 8px;
    overflow: hidden;
    cursor: grab;
}

.org-structure-draft-panel {
    margin-top: 1rem;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0.75rem;
}

.org-structure-draft-form {
    display: grid;
    grid-template-columns: repeat(6, minmax(120px, 1fr));
    gap: 0.45rem;
    align-items: end;
    margin-bottom: 0.7rem;
}

.org-structure-draft-form label {
    font-size: 0.75rem;
    color: #374151;
}

#org-structure-draft-ops-table {
    margin-top: 0.5rem;
}

#org-structure-draft-ops-table th,
#org-structure-draft-ops-table td {
    font-size: 0.8rem;
    padding: 0.45rem 0.55rem;
}

.org-structure-editor-canvas.is-panning {
    cursor: grabbing;
}

.org-structure-scene {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: 0 0;
}

.org-structure-node {
    position: absolute;
    width: 220px;
    min-height: 86px;
    padding: 0.6rem 0.7rem;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.org-structure-node:active {
    cursor: grabbing;
}

.org-structure-node.is-dragging {
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.22);
    border-color: #2563eb;
}

.org-structure-node.staged-node {
    border-style: dashed;
    background: #f8fafc;
    opacity: 0.85;
}

.org-structure-node.org-node {
    border-left: 5px solid #2563eb;
}

.org-structure-node.users-node {
    border-left: 5px solid #0f766e;
}

.org-structure-node.cases-node {
    border-left: 5px solid #b45309;
}

.org-structure-node-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 0.25rem;
}

.org-structure-node-subtitle {
    margin: 0;
    font-size: 0.8rem;
    color: #475569;
}

.org-structure-node-count {
    display: inline-block;
    margin-top: 0.42rem;
    font-size: 0.78rem;
    color: #1f2937;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 0.15rem 0.5rem;
}

.org-structure-edge-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.org-structure-edge-line {
    stroke: #94a3b8;
    stroke-width: 2;
    fill: none;
}

.org-structure-edge-line.staged-edge {
    stroke: #f59e0b;
    stroke-dasharray: 6 4;
}

.org-structure-edge-line.dragging-edge {
    stroke: #0ea5e9;
}

.org-structure-rewire-handle {
    position: absolute;
    right: 0.35rem;
    bottom: 0.3rem;
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 999px;
    border: 1px solid #94a3b8;
    background: #fff;
    color: #334155;
    font-size: 0.85rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: crosshair;
    padding: 0;
}

.org-structure-rewire-handle:hover {
    border-color: #0ea5e9;
    color: #0c4a6e;
}

@media (max-width: 900px) {
    .org-structure-editor-canvas {
        min-height: 440px;
    }
    .org-structure-node {
        width: 200px;
    }
}

.modal-tabs-close-btn {
    flex: 0 0 auto;
    border: none;
    border-radius: 4px;
    background: #e5e7eb;
    color: #111827;
    padding: 0.46rem 0.82rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 0.05rem;
}

.modal-tabs-close-btn:hover {
    background: #d1d5db;
}

.modal-tab-btn {
    padding: 0.5rem 0;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    border-bottom: 2px solid transparent;
}

.modal-tab-btn.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.modal-tab-content {
    display: none;
}

.modal-tab-content.active {
    display: block;
}

.modal-tab-content-scroll {
    display: block;
    margin-bottom: 1.2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-tab-content-scroll:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.modal-section-title {
    margin: 0 0 0.65rem 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #111827;
}

.modal-inline-save-wrap {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.8rem;
}

.modal-inline-save-btn {
    background: #1d4ed8;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 0.5rem 0.95rem;
    cursor: pointer;
    font-weight: 600;
}

.modal-inline-save-btn:hover {
    background: #1e40af;
}

@media (max-width: 760px) {
    .modal-tabs-sticky {
        flex-wrap: wrap;
        align-items: center;
    }

    .modal-tabs-save-btn,
    .modal-tabs-close-btn {
        margin-left: auto;
    }
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    width: 450px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.modal-content.modal-content-wide {
    width: min(1180px, 96vw);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.modal-content h2 { margin-bottom: 0; }

.modal-close-top {
    border: none;
    border-radius: 4px;
    background: #e5e7eb;
    color: #111827;
    padding: 0.45rem 0.8rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
}

.modal-close-top:hover {
    background: #d1d5db;
}

.modal-content form input:not([type="checkbox"]):not([type="radio"]),
.modal-content form select,
.modal-content form textarea {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.modal-content form input[type="checkbox"],
.modal-content form input[type="radio"] {
    width: auto;
    padding: 0;
    margin-bottom: 0;
    border: 0;
    border-radius: 0;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

.modal-actions button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#modal-cancel { background: #e5e7eb; }
#modal-save { background: #2563eb; color: white; }

.pagination-container {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
}

.pagination button {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e5e7eb;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
}

.pagination button.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.pagination button:hover:not(.active) {
    background: #f9fafb;
}

.pagination button.nav-btn {
    min-width: 2.2rem;
    font-weight: 600;
}

.pagination button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.pagination-ellipsis {
    color: #6b7280;
    padding: 0.5rem 0.1rem;
    font-size: 0.9rem;
}

.pagination-meta {
    color: #4b5563;
    font-size: 0.85rem;
    margin-left: 0.35rem;
    margin-right: 0.15rem;
}

.pagination-jump {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: #4b5563;
}

.pagination-jump input {
    width: 4.5rem;
    padding: 0.35rem 0.45rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.85rem;
}

.multi-select-container {
    border: 1px solid #e5e7eb;
    padding: 0.75rem;
    border-radius: 4px;
    max-height: 160px;
    overflow-y: auto;
    margin-top: 4px;
    margin-bottom: 1rem;
    background: #fff;
}

.multi-select-container-large {
    max-height: 420px;
    min-height: 280px;
    overflow: auto;
    padding: 0.35rem;
}

.multi-select-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
}

.multi-select-item input[type="checkbox"] {
    width: auto !important;
    margin: 4px 0 0 0 !important;
    cursor: pointer;
}

.multi-select-item label {
    margin: 0 !important;
    cursor: pointer;
    font-size: 0.875rem;
    line-height: 1.4;
    color: #374151;
    text-align: left;
}

.entitlement-scope-item {
    display: block;
    margin-bottom: 0.55rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid #f1f5f9;
}

.entitlement-scope-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.entitlement-scope-main {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.entitlement-scope-main input[type="checkbox"] {
    width: auto !important;
    margin: 4px 0 0 0 !important;
}

.entitlement-scope-main label {
    margin: 0 !important;
    font-size: 0.875rem;
    line-height: 1.35;
    color: #374151;
}

.entitlement-scope-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0.35rem 0 0 1.75rem;
}

.entitlement-scope-controls span {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #6b7280;
    letter-spacing: 0.02em;
}

.entitlement-scope-controls select {
    width: 180px;
    min-width: 180px;
    margin: 0;
    padding: 0.32rem 0.45rem;
    font-size: 0.8rem;
}

.badge {
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    background: #f3f4f6;
    color: #374151;
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    cursor: zoom-out;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    cursor: default;
}

/* GOV.UK design system adaptation layer */
body.safesignal-govuk {
    font-family: GDS Transport, arial, sans-serif;
    background: #f3f2f1;
    color: #0b0c0c;
}

body.safesignal-govuk #app.govuk-width-container {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

body.safesignal-govuk #main-view header {
    background: #0b0c0c;
    color: #ffffff;
    border-bottom: 6px solid #1d70b8;
}

body.safesignal-govuk #main-view {
    overflow-x: hidden;
}

body.safesignal-govuk #main-view header h1,
body.safesignal-govuk #main-view header #user-name {
    color: #ffffff;
}

body.safesignal-govuk nav {
    background: #ffffff;
    border-bottom: 2px solid #b1b4b6;
}

body.safesignal-govuk .tab-content {
    background: #ffffff;
    border: 1px solid #b1b4b6;
    border-top: none;
    border-left: none;
    border-right: none;
    margin: 0;
    padding: 1.5rem 2rem;
    overflow-x: auto;
    max-width: 100%;
    box-sizing: border-box;
}

body.safesignal-govuk .error {
    color: #d4351c;
    font-weight: 700;
    text-align: left;
}

body.safesignal-govuk .tab-btn,
body.safesignal-govuk .nav-group-btn,
body.safesignal-govuk .nav-link {
    font-weight: 700;
}

body.safesignal-govuk .tab-btn.active {
    border-bottom-color: #1d70b8;
    color: #0b0c0c;
}

body.safesignal-govuk .toolbar button,
body.safesignal-govuk #logout-btn,
body.safesignal-govuk #modal-save,
body.safesignal-govuk .edit-btn,
body.safesignal-govuk .btn-blue,
body.safesignal-govuk .btn-green,
body.safesignal-govuk .btn-teal {
    background: #00703c;
    color: #ffffff;
}

body.safesignal-govuk .delete-btn,
body.safesignal-govuk .btn-danger,
body.safesignal-govuk .btn-warning {
    background: #d4351c;
    color: #ffffff;
}

body.safesignal-govuk #modal-cancel,
body.safesignal-govuk .btn-muted,
body.safesignal-govuk .btn-dark,
body.safesignal-govuk .btn-slate {
    background: #505a5f !important;
    color: #ffffff !important;
}

body.safesignal-govuk button:focus,
body.safesignal-govuk input:focus,
body.safesignal-govuk select:focus,
body.safesignal-govuk textarea:focus,
body.safesignal-govuk a:focus {
    outline: 3px solid #fd0;
    outline-offset: 0;
    box-shadow: inset 0 0 0 2px #0b0c0c;
}

body.safesignal-govuk .login-box {
    width: 420px;
    max-width: 92vw;
    border-top: 8px solid #1d70b8;
    border-radius: 0;
    box-shadow: 0 2px 0 #0b0c0c;
}

body.safesignal-govuk table {
    border: 1px solid #b1b4b6;
    box-shadow: none;
}

body.safesignal-govuk #cases-table th,
body.safesignal-govuk #cases-table td {
    white-space: normal;
    word-break: break-word;
    vertical-align: top;
}

body.safesignal-govuk th {
    background: #f3f2f1;
    border-bottom: 2px solid #0b0c0c;
}

body.safesignal-govuk .modal-content {
    border: 4px solid #0b0c0c;
    border-radius: 0;
}

body.safesignal-govuk .safesignal-button-compact.govuk-button {
    margin-bottom: 0;
    min-height: auto;
    padding: 6px 10px;
    font-size: 0.9rem;
    line-height: 1.1;
}

body.safesignal-govuk .toolbar .govuk-button,
body.safesignal-govuk .modal-actions .govuk-button,
body.safesignal-govuk td .govuk-button {
    margin-bottom: 0;
}

body.safesignal-govuk .login-box .govuk-button {
    width: 100%;
    margin-bottom: 0.75rem;
}

body.safesignal-govuk .login-box .govuk-input {
    margin-bottom: 1rem;
}

body.safesignal-govuk .toolbar .govuk-input,
body.safesignal-govuk .toolbar .govuk-select {
    margin-bottom: 0;
    min-height: auto;
}

body.safesignal-govuk .safesignal-primary-nav {
    border-bottom: 2px solid #b1b4b6;
}

body.safesignal-govuk .safesignal-primary-nav .tab-btn,
body.safesignal-govuk .safesignal-primary-nav .nav-group-btn,
body.safesignal-govuk .safesignal-primary-nav .nav-link {
    min-height: 48px;
    line-height: 1.2;
}

body.safesignal-govuk .safesignal-primary-nav .nav-group.is-open > .nav-group-btn {
    background: #f3f2f1;
}

body.safesignal-govuk .safesignal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

body.safesignal-govuk .safesignal-table th,
body.safesignal-govuk .safesignal-table td {
    vertical-align: top;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

body.safesignal-govuk .safesignal-actions-cell {
    white-space: nowrap;
    min-width: 170px;
}

body.safesignal-govuk .modal-content .govuk-form-group {
    margin-bottom: 1rem;
}

body.safesignal-govuk .modal-content .govuk-label:not(.govuk-checkboxes__label):not(.govuk-radios__label) {
    display: block;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

body.safesignal-govuk .modal-content .govuk-input,
body.safesignal-govuk .modal-content .govuk-select,
body.safesignal-govuk .modal-content .govuk-textarea,
body.safesignal-govuk .modal-content .govuk-file-upload {
    margin-bottom: 0;
}

body.safesignal-govuk .modal-content .govuk-checkboxes {
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
}

body.safesignal-govuk .modal-content .multi-select-container.govuk-checkboxes {
    border: 1px solid #b1b4b6;
    border-radius: 4px;
    background: #fff;
    padding: 0.5rem;
    margin-top: 0.25rem;
    margin-bottom: 1rem;
}

body.safesignal-govuk .modal-content .multi-select-container.govuk-checkboxes .multi-select-item {
    display: block;
    margin-bottom: 0.35rem;
}

body.safesignal-govuk .modal-content .multi-select-container.govuk-checkboxes .multi-select-item:last-child {
    margin-bottom: 0;
}

body.safesignal-govuk .modal-content .multi-select-container.govuk-checkboxes .govuk-checkboxes__label {
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.25;
    color: #0b0c0c;
}

body.safesignal-govuk .modal-content .govuk-checkboxes__item {
    position: relative;
    min-height: 40px;
    padding: 0 0 0 40px;
    margin-bottom: 0.5rem;
}

body.safesignal-govuk .modal-content .govuk-checkboxes__input {
    position: absolute;
    z-index: 1;
    top: 0;
    left: 0;
    width: 40px !important;
    height: 40px;
    margin: 0;
    cursor: pointer;
    opacity: 0;
}

body.safesignal-govuk .modal-content .govuk-checkboxes__label {
    display: inline-block;
    padding: 8px 15px 5px;
    margin-bottom: 0;
    font-weight: 600;
}

body.safesignal-govuk .modal-add-entry-btn {
    margin-top: 0.5rem;
}

body.safesignal-govuk .cases-columns-hint {
    margin: -0.35rem 0 0.9rem;
    color: #505a5f;
    font-size: 0.9rem;
}

@media (max-width: 1024px) {
    body.safesignal-govuk #main-view header {
        padding: 0.85rem 1rem;
    }

    body.safesignal-govuk nav.safesignal-primary-nav {
        padding: 0;
        overflow: visible;
    }

    body.safesignal-govuk .nav-scroll-wrapper {
        padding: 0.25rem 0.5rem;
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    body.safesignal-govuk .safesignal-primary-nav .tab-btn,
    body.safesignal-govuk .safesignal-primary-nav .nav-group-btn,
    body.safesignal-govuk .safesignal-primary-nav .nav-link {
        padding: 0.75rem 0.8rem;
        font-size: 0.95rem;
        min-height: 44px;
    }

    body.safesignal-govuk .push-right {
        margin-left: 0;
    }

    body.safesignal-govuk .tab-content {
        padding: 1.2rem;
    }

    body.safesignal-govuk .safesignal-table {
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    body.safesignal-govuk #main-view header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.65rem;
    }

    body.safesignal-govuk .user-info {
        width: 100%;
        justify-content: space-between;
    }

    body.safesignal-govuk .toolbar {
        flex-wrap: wrap;
        align-items: stretch;
    }

    body.safesignal-govuk .toolbar .govuk-input,
    body.safesignal-govuk .toolbar-filter-input {
        width: 100%;
        min-width: 0;
    }

    body.safesignal-govuk .user-status-filters {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    body.safesignal-govuk .toolbar-help-text,
    body.safesignal-govuk .cases-columns-hint {
        width: 100%;
    }

    body.safesignal-govuk .modal-content {
        width: calc(100vw - 1rem);
        max-width: calc(100vw - 1rem);
        max-height: 95vh;
        padding: 1rem;
    }

    body.safesignal-govuk .safesignal-table th,
    body.safesignal-govuk .safesignal-table td {
        padding-left: 0.55rem;
        padding-right: 0.55rem;
    }

    body.safesignal-govuk .safesignal-actions-cell {
        min-width: 0;
        white-space: normal;
    }

    body.safesignal-govuk .vulcan-table-actions {
        white-space: normal;
    }
}

/* Dashboard Styles */
body.safesignal-govuk .dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

body.safesignal-govuk .dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #1d70b8;
}

body.safesignal-govuk .dashboard-header h1 {
    margin: 0;
}

body.safesignal-govuk .dashboard-scope {
    color: #505a5f;
    font-size: 0.875rem;
}

body.safesignal-govuk .dashboard-widget {
    background: #ffffff;
    border: 1px solid #b1b4b6;
    border-radius: 4px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

body.safesignal-govuk .dashboard-widget--urgent {
    border-left: 5px solid #d4351c;
}

body.safesignal-govuk .dashboard-widget--stats {
    background: #f3f2f1;
}

body.safesignal-govuk .dashboard-widget h2 {
    margin-top: 0;
    margin-bottom: 1rem;
}

body.safesignal-govuk .dashboard-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

body.safesignal-govuk #service-api-performance {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

body.safesignal-govuk .dashboard-stat {
    text-align: center;
    padding: 1.5rem;
    background: #ffffff;
    border-radius: 4px;
    border: 1px solid #b1b4b6;
}

body.safesignal-govuk .dashboard-stat__number {
    font-size: 2.5rem;
    font-weight: bold;
    color: #1d70b8;
    margin-bottom: 0.5rem;
}

body.safesignal-govuk .dashboard-stat__label {
    font-size: 0.875rem;
    color: #505a5f;
}

body.safesignal-govuk .dashboard-alert-list,
body.safesignal-govuk .dashboard-case-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

body.safesignal-govuk .dashboard-alert-item,
body.safesignal-govuk .dashboard-case-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: #f8f8f8;
    border-radius: 4px;
    border-left: 4px solid #505a5f;
}

body.safesignal-govuk .dashboard-alert-item--critical {
    background: #fdf2f2;
    border-left-color: #d4351c;
}

body.safesignal-govuk .dashboard-alert-item--warning {
    background: #fff7eb;
    border-left-color: #f47738;
}

body.safesignal-govuk .dashboard-case-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
}

body.safesignal-govuk .dashboard-case-name {
    font-weight: 600;
    min-width: 150px;
}

body.safesignal-govuk .dashboard-case-meta {
    color: #505a5f;
    font-size: 0.875rem;
}

body.safesignal-govuk .dashboard-case-actions {
    display: flex;
    gap: 0.5rem;
}

body.safesignal-govuk .dashboard-table {
    width: 100%;
    border-collapse: collapse;
}

body.safesignal-govuk .dashboard-table th,
body.safesignal-govuk .dashboard-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #b1b4b6;
}

body.safesignal-govuk .dashboard-table th {
    background: #f3f2f1;
    font-weight: 600;
}

body.safesignal-govuk .dashboard-activity-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

body.safesignal-govuk .dashboard-activity-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: #f8f8f8;
    border-radius: 4px;
    font-size: 0.875rem;
}

body.safesignal-govuk .dashboard-activity-time {
    color: #505a5f;
    min-width: 100px;
}

body.safesignal-govuk .dashboard-activity-action {
    flex: 1;
}

body.safesignal-govuk .dashboard-activity-user {
    color: #505a5f;
}

body.safesignal-govuk .dashboard-quick-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

body.safesignal-govuk .dashboard-trends {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

body.safesignal-govuk .dashboard-trend-item {
    background: #ffffff;
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid #b1b4b6;
}

body.safesignal-govuk .dashboard-trend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

body.safesignal-govuk .dashboard-trend-value {
    font-size: 2rem;
    font-weight: bold;
    color: #1d70b8;
}

body.safesignal-govuk .dashboard-trend-change {
    font-size: 0.875rem;
    font-weight: 600;
}

body.safesignal-govuk .dashboard-trend-change--up {
    color: #00703c;
}

body.safesignal-govuk .dashboard-trend-change--down {
    color: #d4351c;
}

/* Stat colors for CSP compliance */
body.safesignal-govuk .stat-up {
    color: #00703c;
}

body.safesignal-govuk .stat-down {
    color: #d4351c;
}

body.safesignal-govuk .stat-neutral {
    color: #1d70b8;
}

body.safesignal-govuk .trend-up {
    color: #00703c;
}

body.safesignal-govuk .trend-down {
    color: #d4351c;
}

/* Additional stat colors for CSP compliance */
body.safesignal-govuk .stat-success {
    color: #00703c;
}

body.safesignal-govuk .stat-danger {
    color: #d4351c;
}

body.safesignal-govuk .stat-warning {
    color: #f47738;
}

body.safesignal-govuk .stat-info {
    color: #1d70b8;
}

/* Status badges */
body.safesignal-govuk .status-badge {
    display: inline-block;
    font-weight: bold;
}

body.safesignal-govuk .status-badge.status-alert {
    color: #d4351c;
}

body.safesignal-govuk .dashboard-empty-state {
    text-align: center;
    padding: 3rem;
    color: #505a5f;
}

body.safesignal-govuk .dashboard-loading {
    text-align: center;
    padding: 2rem;
    color: #505a5f;
}

@media (max-width: 768px) {
    body.safesignal-govuk .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    body.safesignal-govuk .dashboard-stats-grid {
        grid-template-columns: 1fr;
    }
    
    body.safesignal-govuk .dashboard-alert-item,
    body.safesignal-govuk .dashboard-case-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    body.safesignal-govuk .dashboard-case-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
}

