/* Neighbourly ATLAS - Global Styles */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    font-family: var(--font-body);
    margin: 0;
    padding: 0;
    background: var(--bg-app);
    color: var(--text-default);
}

a, .btn-link {
    color: var(--color-primary);
}

.btn-primary {
    color: #fff;
    background-color: var(--color-primary);
    border-color: var(--color-primary-hover);
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
    border-color: #004499;
}

.btn-outline-primary {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn-outline-primary:hover {
    background-color: var(--color-primary);
    color: white;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: var(--focus-ring);
}

.form-control, .form-select {
    border-radius: 6px;
    border: 1px solid #ced4da;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--color-primary);
    box-shadow: var(--focus-ring);
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwN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SAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

/* ── Entity detail pages ──────────────────────────────────────────────────── */
.entity-detail-page {
    padding: 1.5rem 2rem;
    max-width: 1000px;
}

.detail-loading {
    padding: 2rem;
    color: #6c757d;
}

.breadcrumb-bar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.breadcrumb-bar a {
    color: var(--color-primary);
    text-decoration: none;
}

.breadcrumb-bar a:hover {
    text-decoration: underline;
}

.detail-body {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-top: 1.5rem;
}

.detail-section {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
}

.detail-section h2 {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f0f0f0;
}

.section-header h2 {
    margin: 0;
    padding: 0;
    border: none;
}

.entity-detail-page .detail-grid {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.4rem 1.5rem;
    margin: 0;
    font-size: 0.9rem;
}

.entity-detail-page .detail-grid dt {
    color: #6c757d;
    font-weight: 500;
}

.entity-detail-page .detail-grid dd {
    margin: 0;
    word-break: break-word;
}

/* Inline add form inside detail sections */
.inline-add-form {
    background: #f8f9fa;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
}

/* Nav divider — renders as a subtle vertical bar between nav link groups */
.nav-divider {
    display: inline-block;
    width: 1px;
    height: 1em;
    background: rgba(255, 255, 255, 0.25);
    margin: 0 0.15rem;
    vertical-align: middle;
    align-self: center;
    flex-shrink: 0;
}

/* Area label in the chrome nav (Enterprise / World directory). Light-on-dark to match the chrome. */
.nav-section-label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    align-self: center;
    padding: 0 0.1rem;
    flex-shrink: 0;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ── Entity detail page header ────────────────────────────────────────────── */
.entity-detail-page .page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.entity-detail-page .page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
    color: var(--text-strong);
}

.entity-detail-page .page-header p {
    color: #495057;
    margin: 0;
}

.entity-detail-page .header-content {
    flex: 1;
    min-width: 0;
}

.entity-detail-page .header-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    align-items: flex-start;
}

/* Shared operator entity list/detail page styling (Sites, Organizations, Partners) */
.entity-list-page {
    padding: 1.25rem 1.5rem;
}

.entity-list-page .page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.entity-list-page .page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
    color: var(--text-strong);
}

.entity-list-page .page-header p {
    color: #495057;
    margin: 0;
    max-width: 720px;
}

.entity-list-page .header-actions .spin {
    animation: entity-spin 1s linear infinite;
}

@keyframes entity-spin {
    to { transform: rotate(360deg); }
}

.entity-list-page .filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    padding: 0.75rem 0;
    flex-wrap: wrap;
}

.entity-list-page .filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 12rem;
}

.entity-list-page .filter-group--grow {
    flex: 1;
    min-width: 16rem;
}

.entity-list-page .filter-group label {
    font-size: 0.8rem;
    color: #495057;
    margin: 0;
}

.entity-list-page .summary-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #495057;
    font-size: 0.9rem;
    padding: 0.5rem 0 0.75rem;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    margin-bottom: 0.85rem;
}

.entity-list-page .summary-bar .separator {
    color: #adb5bd;
}

.entity-list-page .summary-bar .muted {
    color: #6c757d;
    font-style: italic;
}

.entity-list-page .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 3rem 1rem;
    color: #6c757d;
    text-align: center;
}

.entity-list-page .empty-state i {
    font-size: 2.25rem;
}

.entity-list-page .entity-table {
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
}

.entity-list-page .entity-table tbody tr {
    cursor: pointer;
}

.entity-list-page .entity-detail-row {
    background: #fafbfc;
}

.entity-list-page .detail-grid {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.35rem 1.5rem;
    margin: 0;
    font-size: 0.875rem;
}

.entity-list-page .detail-grid dt {
    color: #6c757d;
    font-weight: 500;
}

.entity-list-page .detail-grid dd {
    margin: 0;
    color: #212529;
    word-break: break-word;
}

.entity-list-page .detail-actions {
    margin-top: 0.6rem;
    display: flex;
    gap: 0.5rem;
}

.entity-list-page .pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    margin-top: 1rem;
}

.entity-list-page .pager-status {
    color: #495057;
    font-size: 0.875rem;
}

/* Shared dialog/modal pattern for operator forms (no JS interop) */
.atlas-modal-backdrop {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: 1040;
}

.atlas-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.3);
    width: min(720px, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    z-index: 1050;
}

.atlas-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.atlas-modal-header h2 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-strong);
}

.atlas-modal-body {
    padding: 1rem 1.25rem;
    overflow-y: auto;
}

.atlas-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
    margin-top: 1rem;
}

.atlas-modal .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.65rem 1rem;
}

.atlas-modal .form-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.atlas-modal .form-field label {
    font-size: 0.8rem;
    color: #495057;
    margin: 0;
}

.atlas-modal .form-field--check {
    align-self: end;
}

.atlas-modal .form-field--wide {
    grid-column: 1 / -1;
}

/* ── Entity detail page tabs ──────────────────────────────────────────────── */
.entity-detail-tabs {
    margin-top: 1rem;
    border-bottom: 1px solid #dee2e6;
}

.entity-detail-tabs .nav-link {
    color: #495057;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    background: transparent;
}

.entity-detail-tabs .nav-link:hover {
    color: var(--color-primary);
    border-bottom-color: #cfe2ff;
}

.entity-detail-tabs .nav-link.active {
    color: var(--color-primary);
    background: transparent;
    border-bottom-color: var(--color-primary);
    font-weight: 600;
}

.entity-detail-tabs .nav-link .bi {
    margin-right: 0.35rem;
}

.entity-detail-tab-content {
    margin-top: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ── Audit history component ──────────────────────────────────────────────── */
.audit-history__table {
    margin-bottom: 0;
}

.audit-history__table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
}

.audit-history__actor {
    max-width: 220px;
}

.audit-history__diff-row td {
    background: #f8f9fa;
}

.audit-history__diff {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
}

.audit-history__diff-panel {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.audit-history__diff-panel--old {
    border-color: #f5c2c7;
}

.audit-history__diff-panel--new {
    border-color: #badbcc;
}

.audit-history__diff-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.35rem 0.6rem;
    background: #f8f9fa;
    border-bottom: 1px solid var(--border);
    color: #6c757d;
}

.audit-history__diff-panel--old .audit-history__diff-label {
    background: #fdf3f4;
    color: #842029;
}

.audit-history__diff-panel--new .audit-history__diff-label {
    background: #f0f9f4;
    color: #0f5132;
}

.audit-history__diff-json {
    margin: 0;
    padding: 0.6rem 0.75rem;
    font-size: 0.75rem;
    line-height: 1.35;
    max-height: 280px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    background: #fff;
    color: var(--text-strong);
}

@media (max-width: 768px) {
    .audit-history__diff {
        grid-template-columns: 1fr;
    }
}

/* ── Operating hours editor ───────────────────────────────────────────────── */
.operating-hours-grid input[type="time"] {
    max-width: 9rem;
}

.operating-hours-grid__row--dirty {
    background-color: #fff8e1;
}

.operating-hours-grid__row--dirty td {
    border-top-color: #f0d68c;
}

/* Continued-day rows (additional shifts on the same weekday) sit visually
   subordinate to the first row: no top border, faint background tint so the
   eye groups them under the day label. */
.operating-hours-grid__day-continued > td {
    border-top: 0;
    background-color: #fbfbfc;
}

.operating-hours-grid__day-first > td {
    border-top: 1px solid #dee2e6;
}

/* ── Completeness Report ──────────────────────────────────────────────────── */
.completeness-report {
    padding: 1.5rem 2rem;
    max-width: 1400px;
}

.completeness-filters {
    background: #f8f9fa;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.completeness-filters__row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
}

.completeness-filters__field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 9rem;
}

.completeness-filters__field span {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
    font-weight: 600;
}

.completeness-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    font-weight: 700;
    text-decoration: none;
}

.completeness-cell--ok {
    background: #d1e7dd;
    color: #0a3622;
    cursor: default;
}

.completeness-cell--missing {
    background: #f8d7da;
    color: #842029;
}

.completeness-cell--missing:hover {
    background: #f5c2c7;
    color: #58151c;
}

.completeness-score {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.completeness-score--full { background: #d1e7dd; color: #0a3622; }
.completeness-score--high { background: #cfe2ff; color: #084298; }
.completeness-score--mid  { background: #fff3cd; color: #664d03; }
.completeness-score--low  { background: #f8d7da; color: #842029; }

.enrichment-missing-badge {
    background: #fff3cd;
    color: #664d03;
    font-weight: 500;
    text-transform: lowercase;
}

/* ── AssignRoleDialog ─────────────────────────────────────────────────────── */
.assign-role-results {
    list-style: none;
    margin: 0.25rem 0 0;
    padding: 0;
    max-height: 14rem;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.assign-role-results li {
    border-bottom: 1px solid #f0f0f0;
}

.assign-role-results li:last-child {
    border-bottom: 0;
}

.assign-role-results__row {
    width: 100%;
    text-align: left;
    background: #fff;
    border: 0;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
}

.assign-role-results__row:hover {
    background: #f1f5fb;
}

.assign-role-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.4rem 0.6rem;
    background: #f8f9fa;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.completeness-grid th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
}

.dq-splash, .empty-state {
    padding: 2rem;
    text-align: center;
    color: #6c757d;
}

.empty-state .bi {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

