@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&family=Roboto+Slab:wght@100;300;700&display=swap');

/**
 * Dataline brand tokens, the same as Dataline 360's, applied on top of stock Bootstrap 5 rather than a Sass rebuild
 * (there is no Node/build step: AssetMapper serves Bootstrap's precompiled CSS as-is). Bootstrap 5.3's root custom
 * properties cover most utilities and components; buttons and form checks bake their colours into component-scoped
 * variables, so those are overridden explicitly.
 */
:root {
    --bs-primary: #0000ff;
    --bs-primary-rgb: 0, 0, 255;
    --bs-primary-text-emphasis: #00008a;
    --bs-primary-bg-subtle: #d6d6ff;
    --bs-primary-border-subtle: #adadff;

    --bs-link-color: #0000ff;
    --bs-link-color-rgb: 0, 0, 255;
    --bs-link-hover-color: #0000cc;
    --bs-link-hover-color-rgb: 0, 0, 204;

    --bs-focus-ring-color: rgba(0, 0, 255, 0.25);

    --bs-body-font-family: 'Roboto', system-ui, sans-serif;
    --bs-body-color: #231f20;

    --bs-border-radius: 0.5rem;
    --bs-border-radius-lg: 0.75rem;

    --db-heading-font: 'Roboto Slab', ui-serif, Georgia, serif;
    --db-accent-cyan: #00aeef;
    --db-accent-pink: #ff178a;
    --db-accent-purple: #7c1983;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--db-heading-font);
}

.btn-primary {
    --bs-btn-bg: #0000ff;
    --bs-btn-border-color: #0000ff;
    --bs-btn-hover-bg: #0000cc;
    --bs-btn-hover-border-color: #0000bf;
    --bs-btn-active-bg: #0000bf;
    --bs-btn-active-border-color: #0000b3;
    --bs-btn-focus-shadow-rgb: 51, 51, 255;
    --bs-btn-disabled-bg: #0000ff;
    --bs-btn-disabled-border-color: #0000ff;
}

.btn-outline-primary {
    --bs-btn-color: #0000ff;
    --bs-btn-border-color: #0000ff;
    --bs-btn-hover-bg: #0000ff;
    --bs-btn-hover-border-color: #0000ff;
    --bs-btn-active-bg: #0000cc;
    --bs-btn-active-border-color: #0000cc;
    --bs-btn-focus-shadow-rgb: 51, 51, 255;
}

.form-check-input:checked {
    background-color: #0000ff;
    border-color: #0000ff;
}

.form-check-input:focus {
    box-shadow: 0 0 0 0.25rem var(--bs-focus-ring-color);
}

/* ==========================================================================
 * App shell: sidebar, top bar and content column (the same layout as Dataline 360's /app section).
 * ========================================================================== */
.app {
    --app-sidebar-width: 16.5rem;
    --app-sidebar-bg: #0b0b3b;
    --app-sidebar-color: rgba(255, 255, 255, 0.72);
    --app-sidebar-hover-bg: rgba(255, 255, 255, 0.08);
    --app-sidebar-active-bg: rgba(0, 174, 239, 0.18);
    --app-surface: #f5f6fa;
    --app-card-border: #e4e6ef;

    background: var(--app-surface);
}

.app .min-w-0 {
    min-width: 0;
}

/* Bootstrap 5.3 underlines every link; in an app UI that's noise in tables, cards and menus. */
.app a:not(.btn) {
    text-decoration: none;
}

.app .app-content a:not(.btn):not(.card):not(.dist-row):hover {
    text-decoration: underline;
}

.app .app-shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar ---------------------------------------------------------------- */
/* !important: from the lg breakpoint up, Bootstrap's .offcanvas-lg forces background-color: transparent !important. */
.app .app-sidebar {
    --bs-offcanvas-width: var(--app-sidebar-width);
    --bs-offcanvas-bg: var(--app-sidebar-bg);
    background-color: var(--app-sidebar-bg) !important;
    color: var(--app-sidebar-color);
    display: flex;
    flex-direction: column;
}

@media (min-width: 992px) {
    .app .app-sidebar {
        position: sticky;
        top: 0;
        width: var(--app-sidebar-width);
        height: 100vh;
        flex-shrink: 0;
        overflow-y: auto;
    }
}

.app .sidebar-brand {
    padding: 1.25rem 1.25rem 1rem;
}

.app .brand-wordmark {
    font-family: var(--db-heading-font);
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
}

.app .brand-wordmark span {
    color: var(--db-accent-cyan);
}

.app .sidebar-nav {
    padding: 0.25rem 0.75rem 1.5rem;
}

.app .sidebar-heading {
    margin: 1.1rem 0.75rem 0.35rem;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.45);
}

.app .sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    color: var(--app-sidebar-color);
    text-decoration: none;
    font-size: 0.925rem;
}

.app .sidebar-link:hover,
.app .sidebar-link:focus-visible {
    background: var(--app-sidebar-hover-bg);
    color: #fff;
}

.app .sidebar-link.active {
    background: var(--app-sidebar-active-bg);
    color: #fff;
    font-weight: 500;
    box-shadow: inset 3px 0 0 var(--db-accent-cyan);
}

/* Main column ------------------------------------------------------------ */
.app .app-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app .app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 3.75rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--app-card-border);
}

@media (min-width: 992px) {
    .app .app-topbar {
        padding: 0.5rem 2rem;
    }
}

.app .app-topbar .breadcrumb {
    font-size: 0.9rem;
}

.app .btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.6rem;
    border: 0;
    border-radius: 0.5rem;
    color: var(--bs-secondary-color);
}

.app .btn-icon.btn-sm {
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.4rem;
}

.app .btn-icon:hover,
.app .btn-icon:focus-visible {
    background: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
}

.app .user-button {
    padding: 0.25rem;
    border: 0;
}

.app .app-user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: var(--bs-primary);
    color: #fff;
    font-weight: 600;
}

.app .app-content {
    flex: 1 0 auto;
    display: block;
    width: 100%;
    max-width: 100rem;
    padding: 1.5rem 1rem 3rem;
}

@media (min-width: 992px) {
    .app .app-content {
        padding: 2rem 2rem 4rem;
    }
}

/* Cards, lists ------------------------------------------------------------ */
.app .card {
    border-color: var(--app-card-border);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.app .card-header {
    background: #fff;
    border-bottom-color: var(--app-card-border);
    font-weight: 500;
}

.app .page-title {
    font-weight: 700;
}

.app .filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--app-card-border);
}

.app .filter-bar .filter-input {
    flex: 1 1 20rem;
}

.app .filter-bar .form-select {
    flex: 0 1 11rem;
}

.app .filter-bar .btn-link {
    text-decoration: none;
}

@media (max-width: 575.98px) {
    .app .filter-bar .form-select {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: 0;
    }
}

.app .data-table {
    margin-bottom: 0;
    font-size: 0.925rem;
}

.app .data-table thead th {
    background: #fafbfd;
    color: var(--bs-secondary-color);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    border-bottom-color: var(--app-card-border);
    vertical-align: middle;
}

.app .data-table td {
    vertical-align: middle;
    border-color: #eef0f5;
}

/* KnpPaginator's sortable column headers (bootstrap_v5_bi_sortable_link): .asc/.desc mark the active sort. */
.app .data-table thead th a {
    color: inherit;
    text-decoration: none;
}

.app .data-table thead th a:hover,
.app .data-table thead th a.asc,
.app .data-table thead th a.desc {
    color: var(--bs-primary);
}

.app .data-table thead th a .float-end {
    margin-left: 0.35rem;
}

.app .empty-state-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
    font-size: 1.5rem;
}

/* Dashboard ---------------------------------------------------------------- */
/* .card is a flex column; these cards are a row (icon + text). */
.app .stat-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    color: inherit;
    text-decoration: none;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.app a.stat-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(16, 24, 40, 0.08);
}

.app .stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    flex-shrink: 0;
    border-radius: 0.75rem;
    font-size: 1.25rem;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
}

.app .stat-icon.tone-cyan {
    background: rgba(0, 174, 239, 0.12);
    color: #007fae;
}

.app .stat-icon.tone-pink {
    background: rgba(255, 23, 138, 0.1);
    color: #c40063;
}

.app .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
}

.app .dist-title {
    margin-bottom: 0.75rem;
    font-family: var(--bs-body-font-family);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--bs-secondary-color);
}

/* One bar of a distribution: label, track, count. The whole row links to the filtered list. */
.app .dist-row {
    display: grid;
    grid-template-columns: 5.75rem minmax(3rem, 1fr) 3.25rem;
    align-items: center;
    gap: 0.625rem;
    padding: 0.3rem 0.5rem;
    margin: 0 -0.5rem;
    border-radius: 0.375rem;
    color: inherit;
    font-size: 0.875rem;
}

.app .dist-row:hover {
    background: var(--bs-tertiary-bg);
}

.app .dist-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app .dist-track {
    height: 0.5rem;
    border-radius: 1rem;
    background: #eceef4;
    overflow: hidden;
}

.app .dist-fill {
    display: block;
    height: 100%;
    min-width: 2px;
    border-radius: 1rem;
}

.app .dist-count {
    font-variant-numeric: tabular-nums;
    text-align: right;
    color: var(--bs-secondary-color);
}

/* Duplicate list ------------------------------------------------------------ */
.app .duplicate-table .col-toggle {
    width: 2.75rem;
    padding-right: 0;
}

.app .duplicate-table .record-cell {
    min-width: 12rem;
    max-width: 22rem;
}

.app .record-name {
    padding: 0;
    border: 0;
    background: none;
    color: var(--bs-body-color);
    font-weight: 500;
    text-align: left;
}

.app .record-name:hover {
    color: var(--bs-primary);
}

.app .duplicate-pair.is-open > tr:first-child > * {
    background: var(--bs-primary-bg-subtle);
    border-bottom-color: transparent;
}

.app .compare-row > td {
    padding: 0 0.75rem 1.25rem;
    background: var(--bs-primary-bg-subtle);
}

/* width 0 + min-width 100%: the comparison takes the row's width without widening the list table itself. */
.app .compare {
    width: 0;
    min-width: 100%;
    padding: 1rem;
    border-radius: var(--bs-border-radius);
    background: #fff;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

.app .compare-table {
    font-size: 0.875rem;
}

.app .compare-table thead th {
    color: var(--bs-secondary-color);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.app .compare-table .col-label {
    width: 11rem;
}

.app .compare-table tbody th {
    font-weight: 500;
    color: var(--bs-secondary-color);
    white-space: nowrap;
}

.app .compare-table td {
    width: 50%;
    word-break: break-word;
}

.app .compare-table tr.is-match > * {
    background: var(--bs-success-bg-subtle);
}

.app .compare-table tr.is-mismatch > * {
    background: var(--bs-danger-bg-subtle);
}

.app .compare-heading {
    margin-bottom: 0.5rem;
    font-family: var(--bs-body-font-family);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--bs-secondary-color);
}

.app .score-table {
    font-size: 0.8rem;
}

.app .score-table td:first-child {
    word-break: break-word;
}

.app .score-table thead th {
    color: var(--bs-secondary-color);
    font-weight: 500;
}

/* Score: a small bar with the percentage next to it. */
.app .score {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-variant-numeric: tabular-nums;
}

.app .score-track {
    width: 3.5rem;
    height: 0.375rem;
    border-radius: 1rem;
    background: #eceef4;
    overflow: hidden;
}

.app .score-fill {
    display: block;
    height: 100%;
    border-radius: 1rem;
}

.app .score-value {
    min-width: 2.5rem;
    font-size: 0.85rem;
}

.app .score-success .score-fill { background: var(--bs-success); }
.app .score-info .score-fill { background: var(--bs-info); }
.app .score-warning .score-fill { background: var(--bs-warning); }
.app .score-danger .score-fill { background: var(--bs-danger); }

/* Login ------------------------------------------------------------------ */
.login-page {
    justify-content: center;
}

.login-card {
    max-width: 28rem;
}

/* Group page ------------------------------------------------------------- */
/* One column per record: as wide as the content needs, instead of the pair comparison's two halves. */
.app .group-compare td {
    width: auto;
    min-width: 11rem;
}

.app .duplicate-table .records-cell {
    min-width: 16rem;
}

.app .col-toggle .btn[aria-expanded="true"] .bi-chevron-right {
    transform: rotate(90deg);
}

.app .col-toggle .btn .bi {
    transition: transform 0.15s ease;
}

/* Merge screen ----------------------------------------------------------- */
.app .sticky-actions {
    position: sticky;
    bottom: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    margin-top: 1.5rem;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--app-card-border);
    border-radius: var(--bs-border-radius);
    box-shadow: 0 -4px 12px rgba(16, 24, 40, 0.05);
}

.app .merge-table {
    font-size: 0.875rem;
}

.app .merge-table thead th {
    vertical-align: top;
    text-transform: none;
    letter-spacing: normal;
}

.app .merge-table tbody th {
    font-weight: 500;
    color: var(--bs-secondary-color);
    white-space: nowrap;
}

.app .merge-table .merge-record,
.app .merge-table td {
    min-width: 12rem;
}

.app .merge-table .merge-result {
    min-width: 16rem;
    background: #fafbfd;
}

.app .merge-table tr.is-conflict > th {
    color: var(--bs-body-color);
}

.app .merge-pick {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    cursor: pointer;
}

.app .merge-pick .form-check-input {
    margin-top: 0.2rem;
    flex-shrink: 0;
}

.app .merge-table .is-excluded {
    opacity: 0.4;
}

.app .merge-value.is-edited .form-control,
.app .merge-value.is-edited .form-select {
    border-color: var(--bs-warning);
    background-color: var(--bs-warning-bg-subtle);
}

.app .merge-fixed {
    display: inline-block;
    padding: 0.2rem 0;
}

.app .history .list-group-item {
    border-color: #eef0f5;
}

/* Merge history */

.app .merge-history-table tbody tr {
    position: relative;
}

.app .merge-snapshot td {
    width: auto;
    min-width: 10rem;
}

.app .merge-snapshot .merge-result {
    min-width: 12rem;
    background: var(--bs-tertiary-bg);
    font-weight: 500;
}

.app .merge-snapshot tr.is-changed > * {
    background: var(--bs-warning-bg-subtle);
}

.app .compare-table thead .keep-badge {
    text-transform: none;
    letter-spacing: normal;
}
