 :root {
    --ow-primary: #212529;
    --ow-dark: #212529;
    --ow-light: #f5f6f8;
    --ow-border: #dee2e6;
    --ow-radius: 0.65rem;
    --ow-navbar-height: 58px;
}
html, body { height: 100%; }
body { margin: 0; overflow: hidden; background: var(--ow-light); color: var(--ow-dark); }
.ow-app-shell { height: 100vh; height: 100dvh; display: flex; flex-direction: column; min-height: 0; }
.ow-topbar { position: sticky; top: 0; z-index: 1030; flex: 0 0 auto; }
.ow-app-main { flex: 1 1 auto; min-width: 0; min-height: 0; overflow: auto; }
.ow-footer { flex: 0 0 auto; }
.ow-user-summary { font-size: 0.9rem; font-weight: 600; }
.ow-login-page { min-height: 100%; display: grid; place-items: center; padding: 1rem; }
.ow-login-card { width: min(100%, 420px); }
.ow-dashboard-card { height: 100%; min-height: 170px; border: 2px solid transparent; border-radius: var(--ow-radius); background: #fff; box-shadow: 0 .125rem .25rem rgba(0,0,0,.075); transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.ow-dashboard-link { display: block; height: 100%; color: inherit; text-decoration: none; }
.ow-dashboard-link:hover .ow-dashboard-card, .ow-dashboard-link:focus .ow-dashboard-card { transform: translateY(-3px); border-color: var(--ow-primary); box-shadow: 0 .75rem 1.5rem rgba(0,0,0,.16); }
.ow-dashboard-icon { width: 2.75rem; height: 2.75rem; display: inline-flex; align-items: center; justify-content: center; border-radius: .55rem; background: #f1f3f5; color: var(--ow-primary); font-size: 1.35rem; }
.ow-dashboard-link:hover .ow-dashboard-icon, .ow-dashboard-link:focus .ow-dashboard-icon { background: #e9ecef; }
.ow-content-card { border: 1px solid var(--ow-border); border-radius: var(--ow-radius); background: #fff; box-shadow: 0 .125rem .25rem rgba(0,0,0,.05); }
.ow-list-page { height: 100%; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.ow-page-header { position: sticky; top: 0; z-index: 1020; flex: 0 0 auto; border-bottom: 1px solid var(--ow-border); background: var(--ow-light); }
.ow-list-content { flex: 1 1 auto; min-height: 0; overflow: hidden; padding-top: 1rem; padding-bottom: 1rem; }
.ow-list-content > .container-fluid { height: 100%; display: flex; flex-direction: column; min-height: 0; }
.ow-list-card { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.ow-command-bar { flex: 0 0 auto; border-bottom: 1px solid var(--ow-border); background: #fff; }
.ow-search-group { width: 100%; max-width: 420px; }
.ow-record-count { flex: 0 0 auto; color: #6c757d; font-size: .9rem; white-space: nowrap; }
.ow-add-button { width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; padding: 0; font-size: 1.1rem; }
.ow-table-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; }
.ow-table { margin-bottom: 0; }
.ow-table th, .ow-table td { padding: .75rem .85rem; vertical-align: middle; }
.ow-table thead th { position: sticky; top: 0; z-index: 20; border-bottom: 0; background: var(--ow-dark); color: #fff; font-weight: 600; white-space: nowrap; }
.ow-table tbody tr:nth-child(odd) > * { background-color: #f4f4f4; }
.ow-table tbody tr:nth-child(even) > * { background-color: #fff; }
.ow-table tbody tr:hover > * { background-color: #eceff1; }
.ow-primary-edit-link { color: var(--ow-dark); font-weight: 600; text-decoration: none; }
.ow-primary-edit-link:hover, .ow-primary-edit-link:focus { color: #000; text-decoration: underline; }
.ow-primary-edit-link:focus-visible { border-radius: .2rem; outline: 0; box-shadow: 0 0 0 .2rem rgba(33,37,41,.2); }
.ow-icon-action { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: .4rem; background: transparent; color: var(--ow-dark); font-size: 1.05rem; text-decoration: none; transition: color .15s ease, background-color .15s ease; }
.ow-icon-action:hover, .ow-icon-action:focus { background: #e9ecef; color: #000; outline: none; }
.ow-icon-action:focus-visible { box-shadow: 0 0 0 .2rem rgba(33,37,41,.2); }
.form-control, .form-select { min-height: 44px; }
.ow-form-page { height: 100%; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.ow-form-content { flex: 1 1 auto; min-height: 0; overflow: auto; padding-top: 1rem; padding-bottom: 1rem; }
.ow-form-card { width: 100%; max-width: 900px; overflow: hidden; }
.ow-form-actions { display: flex; flex-wrap: wrap; gap: .75rem; padding: 1rem 1.5rem; border-top: 1px solid var(--ow-border); background: #fff; }
.ow-textarea { min-height: 120px; resize: vertical; }
@media (max-width: 767.98px) {
    .ow-dashboard-card { min-height: 0; }
    .ow-page-header .container-fluid { padding-top: .75rem !important; padding-bottom: .75rem !important; }
    .ow-page-header h1 { font-size: 1.5rem; }
    .ow-command-bar { padding: .75rem !important; }
    .ow-search-group { max-width: none; }
    .ow-table th, .ow-table td { padding: .65rem .7rem; }
    .ow-form-actions { padding: 1rem; }
    .ow-form-actions .btn { flex: 1 1 auto; }
    .ow-footer .container-fluid { padding-right: .75rem; padding-left: .75rem; }
}
@media (max-width: 575.98px) {
    .navbar-brand { font-size: 1rem; }
    .ow-login-page { place-items: start center; padding-top: 1.5rem; }
}


/* ==========================================================================
   TFSHF refinement for list pages
   ========================================================================== */

.ow-tfshf-page {
    height: 100%;
    min-height: 0;
}

/* ==========================================================================
   Toast notifications
   ========================================================================== */

.ow-toast-container {
    position: fixed;
    top: calc(var(--ow-navbar-height) + 0.75rem);
    right: 0.75rem;
    z-index: 1090;
    width: min(360px, calc(100vw - 1.5rem));
    pointer-events: none;
}

.ow-toast-message {
    padding: 0.85rem 1rem;
    border: 1px solid #75b798;
    border-radius: 0.5rem;
    background: #198754;
    color: #ffffff;
    box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.22);
    opacity: 1;
    transform: translateY(0);
    transition:
        opacity 0.6s ease,
        transform 0.6s ease;
}

.ow-toast-message-hide {
    opacity: 0;
    transform: translateY(-0.5rem);
}

/* ==========================================================================
   Return-to-list row highlight and fade
   ========================================================================== */

.ow-data-row:focus {
    outline: none;
}

.ow-data-row.ow-row-highlight > * {
    animation: ow-row-highlight-fade 5s ease-out;
}

@keyframes ow-row-highlight-fade {
    0%,
    72% {
        background-color: #fff3cd;
    }

    100% {
        background-color: inherit;
    }
}

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

/* ==========================================================================
   Entity Edit — fixed action footer with scrollable form body
   ========================================================================== */

.ow-form-content.ow-entity-edit-content {
    overflow: hidden;
}

.ow-form-content.ow-entity-edit-content > .container-fluid {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.ow-form-card.ow-entity-edit-card {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    width: 100%;
    max-width: 900px;
    min-height: 0;
    overflow: hidden;
}

.ow-entity-edit-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.ow-entity-edit-actions {
    flex: 0 0 auto;
}

@media (max-width: 767.98px) {
    .ow-form-content.ow-entity-edit-content {
        overflow: auto;
    }

    .ow-form-content.ow-entity-edit-content > .container-fluid,
    .ow-form-card.ow-entity-edit-card {
        height: auto;
        min-height: min-content;
    }

    .ow-entity-edit-scroll {
        overflow: visible;
    }
}



/* ==========================================================================
   Record tabs
   ========================================================================== */

.ow-record-tabs {
    flex: 0 0 auto;
}

.ow-record-tabs .container-fluid {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}

.ow-record-tabs .nav {
    min-width: max-content;
}

.ow-record-tabs .nav-link {
    color: #495057;
    white-space: nowrap;
}

.ow-record-tabs .nav-link:hover,
.ow-record-tabs .nav-link:focus {
    color: #000;
}

.ow-record-tabs .nav-link.active {
    color: #000;
    font-weight: 600;
}


/* ==========================================================================
   Entity notes
   ========================================================================== */

.ow-notes-list {
    min-height: 0;
}

.ow-note-item {
    color: var(--ow-dark);
    text-decoration: none;
}

.ow-note-item:hover,
.ow-note-item:focus {
    color: #000;
    background: #f5f6f8;
}

.ow-note-text {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
}

.ow-note-editor {
    min-height: 220px;
}


/* ==========================================================================
   Note editor width
   ========================================================================== */

.ow-form-card.ow-entity-edit-card.ow-note-editor-card {
    max-width: none;
}

/* ==========================================================================
   Notes tab panel width
   ========================================================================== */

.ow-form-card.ow-entity-edit-card.ow-notes-card {
    max-width: none;
}



/* ==========================================================================
   Relationships tab panel width
   ========================================================================== */

.ow-form-card.ow-entity-edit-card.ow-relationships-card {
    max-width: none;
}


/* ==========================================================================
   Entity and Communications panel width
   ========================================================================== */

.ow-form-card.ow-entity-edit-card.ow-entity-card,
.ow-form-card.ow-entity-edit-card.ow-communications-card {
    max-width: none;
}

/* ==========================================================================
   Organisation Classification
   ========================================================================== */

.ow-form-card.ow-entity-edit-card.ow-classification-card {
    max-width: none;
}

/* ==========================================================================
   Compact dashboard cards
   ========================================================================== */

.ow-dashboard-grid {
    max-width: 1320px;
    margin-inline: auto;
}

.ow-dashboard-grid > [class*="col-"] {
    width: 100%;
}

.ow-dashboard-card {
    min-height: 135px;
}

@media (min-width: 576px) {
    .ow-dashboard-grid > [class*="col-"] {
        width: 420px;
        max-width: 420px;
    }
}

@media (max-width: 575.98px) {
    .ow-dashboard-grid {
        max-width: none;
    }

    .ow-dashboard-grid > [class*="col-"] {
        width: 100%;
        max-width: none;
    }
}



/* ==========================================================================
   Prospects
   ========================================================================== */

.ow-form-card.ow-entity-edit-card.ow-prospects-card {
    max-width: none;
}

.ow-form-card.ow-entity-edit-card.ow-prospect-form-card {
    width: 100% !important;
    max-width: none !important;
    align-self: stretch;
}

.ow-prospect-textarea {
    min-height: 140px;
    resize: vertical;
}

@media (max-width: 767.98px) {
    .ow-prospect-mobile-hide {
        display: none !important;
    }
}


/* ==========================================================================
   Prospect Setup
   ========================================================================== */

.ow-setup-grid {
    max-width: 900px;
    margin-inline: auto;
}

.ow-setup-grid > [class*="col-"] {
    width: 100%;
}

.ow-setup-card {
    min-height: 145px;
}

@media (min-width: 576px) {
    .ow-setup-grid > [class*="col-"] {
        width: 420px;
        max-width: 420px;
    }
}

@media (max-width: 575.98px) {
    .ow-setup-grid {
        max-width: none;
    }

    .ow-setup-grid > [class*="col-"] {
        width: 100%;
        max-width: none;
    }
}


/* ==========================================================================
   Interactions
   ========================================================================== */

.ow-form-card.ow-entity-edit-card.ow-interactions-card,
.ow-form-card.ow-entity-edit-card.ow-interaction-form-card {
    width: 100% !important;
    max-width: none !important;
    align-self: stretch;
}

.ow-interaction-textarea {
    min-height: 150px;
    resize: vertical;
}


/* ==========================================================================\n   History and Entity Tags\n   ========================================================================== */

.ow-dashboard-history {
    width: min(100%, 1320px);
    margin-inline: auto;
}

.ow-dashboard-history-card {
    overflow: hidden;
}

.ow-history-table th,
.ow-history-table td {
    padding: .55rem .7rem;
    font-size: .9rem;
    vertical-align: middle;
}

.ow-history-table thead th {
    background: var(--ow-dark);
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
}

.ow-history-table tbody tr:nth-child(odd) > * { background: #f7f7f7; }
.ow-history-table tbody tr:nth-child(even) > * { background: #fff; }
.ow-history-table tbody tr:hover > * { background: #eceff1; }

.ow-form-card.ow-entity-edit-card.ow-tags-card {
    width: 100% !important;
    max-width: none !important;
    align-self: stretch;
}

.ow-tag-button {
    border-radius: 999px;
}

@media (max-width: 767.98px) {
    .ow-history-table th,
    .ow-history-table td {
        padding: .5rem .6rem;
        font-size: .85rem;
    }
}


/* ==========================================================================
   Dashboard workspace — vertical navigation + MRU history
   ========================================================================== */

.ow-dashboard-workspace {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(250px, 25%) minmax(0, 75%);
    gap: 1rem;
    padding: 1rem;
    overflow: hidden;
}

.ow-dashboard-nav {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: repeat(5, minmax(0, 1fr));
    gap: .75rem;
}

.ow-dashboard-nav-link {
    min-height: 0;
    color: inherit;
    text-decoration: none;
}

.ow-dashboard-nav-card {
    height: 100%;
    min-height: 0;
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .85rem 1rem;
    border: 1px solid var(--ow-border);
    border-radius: var(--ow-radius);
    background: #fff;
    box-shadow: 0 .125rem .25rem rgba(0,0,0,.05);
    transition:
        border-color .15s ease,
        box-shadow .15s ease,
        transform .15s ease;
}

.ow-dashboard-nav-link:hover .ow-dashboard-nav-card,
.ow-dashboard-nav-link:focus .ow-dashboard-nav-card {
    border-color: var(--ow-dark);
    box-shadow: 0 .35rem .8rem rgba(0,0,0,.10);
    transform: translateX(2px);
}

.ow-dashboard-nav-icon {
    width: 2.55rem;
    height: 2.55rem;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: .5rem;
    background: #f1f3f5;
    color: var(--ow-dark);
    font-size: 1.2rem;
}

.ow-dashboard-nav-copy {
    min-width: 0;
}

.ow-dashboard-nav-copy h2 {
    margin: 0 0 .2rem;
    font-size: .98rem;
    font-weight: 700;
    line-height: 1.2;
}

.ow-dashboard-nav-copy p {
    margin: 0;
    color: #6c757d;
    font-size: .78rem;
    line-height: 1.25;
}

.ow-dashboard-history-panel {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--ow-border);
    border-radius: var(--ow-radius);
    background: #fff;
    box-shadow: 0 .125rem .25rem rgba(0,0,0,.05);
}

.ow-dashboard-history-command {
    flex: 0 0 auto;
    padding: .75rem;
    border-bottom: 1px solid var(--ow-border);
    background: #fff;
}

.ow-dashboard-history-search {
    width: min(100%, 520px);
}

.ow-dashboard-history-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.ow-dashboard-history-table {
    width: 100%;
    margin-bottom: 0;
}

.ow-dashboard-history-table th,
.ow-dashboard-history-table td {
    padding: .62rem .72rem;
    font-size: .88rem;
    vertical-align: middle;
}

.ow-dashboard-history-table thead th {
    position: static;
    background: var(--ow-dark);
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
}

.ow-dashboard-history-table tbody tr:nth-child(odd) > * {
    background: #f7f7f7;
}

.ow-dashboard-history-table tbody tr:nth-child(even) > * {
    background: #fff;
}

.ow-dashboard-history-table tbody tr:hover > * {
    background: #eceff1;
}

@media (max-width: 991.98px) {
    .ow-dashboard-workspace {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 100%;
        overflow: auto;
    }

    .ow-dashboard-nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: none;
        flex: 0 0 auto;
    }

    .ow-dashboard-nav-card {
        min-height: 92px;
    }

    .ow-dashboard-history-panel {
        min-height: 520px;
        flex: 1 1 auto;
    }
}

@media (max-width: 575.98px) {
    .ow-dashboard-workspace {
        gap: .75rem;
        padding: .75rem;
    }

    .ow-dashboard-nav {
        grid-template-columns: 1fr;
        gap: .6rem;
    }

    .ow-dashboard-nav-card {
        min-height: 0;
    }

    .ow-dashboard-nav-copy p {
        display: none;
    }

    .ow-dashboard-history-command {
        padding: .65rem;
    }

    .ow-dashboard-history-search {
        width: 100%;
    }

    .ow-dashboard-history-command form {
        align-items: stretch !important;
        flex-direction: column;
    }

    .ow-dashboard-history-command .ow-record-count {
        margin-left: 0 !important;
    }

    .ow-dashboard-history-panel {
        min-height: 480px;
    }

    .ow-dashboard-history-table th,
    .ow-dashboard-history-table td {
        padding: .55rem .6rem;
        font-size: .84rem;
    }
}


/* ==========================================================================
   Geo Map
   ========================================================================== */

.ow-geo-map-page {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.ow-geo-map-content {
    flex: 1 1 auto;
    min-height: 0;
    padding: 1rem;
}

.ow-geo-map-card {
    height: 100%;
    min-height: 420px;
    overflow: hidden;
    border: 1px solid var(--ow-border);
    border-radius: var(--ow-radius);
    background: #fff;
    box-shadow: 0 .125rem .25rem rgba(0,0,0,.05);
}

#owGeoMap {
    width: 100%;
    height: 100%;
    min-height: 420px;
}

.ow-geo-map-empty {
    height: 100%;
    min-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #6c757d;
    text-align: center;
}

.ow-geo-popup-name {
    font-weight: 700;
    margin-bottom: .25rem;
}

.ow-geo-popup-address {
    margin-bottom: .5rem;
    color: #495057;
}

.ow-geo-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
}

@media (max-width: 575.98px) {
    .ow-geo-map-content {
        padding: .75rem;
    }

    .ow-geo-map-card,
    #owGeoMap,
    .ow-geo-map-empty {
        min-height: 480px;
    }
}


/* ==========================================================================
   Entity Addresses — duplex table / map workspace
   ========================================================================== */

.ow-address-map-workspace {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 44%) minmax(0, 56%);
    gap: .75rem;
}

.ow-form-card.ow-entity-edit-card.ow-addresses-card {
    width: 100% !important;
    max-width: none !important;
    min-width: 0;
    align-self: stretch;
}

.ow-address-map-panel {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border: 1px solid var(--ow-border);
    border-radius: var(--ow-radius);
    background: #fff;
    box-shadow: 0 .125rem .25rem rgba(0,0,0,.05);
}

.ow-address-map {
    width: 100%;
    height: 100%;
    min-height: 420px;
}

.ow-address-map-empty {
    height: 100%;
    min-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #6c757d;
    text-align: center;
}

.ow-address-map-row {
    cursor: pointer;
}

.ow-address-map-row:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: -2px;
}

.ow-address-map-row-selected > * {
    background: #e7f1ff !important;
}

.ow-address-map-marker {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0d6efd;
    font-size: 26px;
    line-height: 1;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,.25));
    transform-origin: 50% 100%;
}

.ow-address-map-marker-selected {
    width: 34px;
    height: 34px;
    color: #084298;
    font-size: 34px;
    filter: drop-shadow(0 3px 3px rgba(0,0,0,.35));
}

@media (max-width: 991.98px) {
    .ow-address-map-workspace {
        display: flex;
        flex-direction: column;
        overflow: visible;
    }

    .ow-address-map-panel {
        min-height: 420px;
    }

    .ow-address-map {
        min-height: 420px;
    }
}

/* .leaflet-tile {
    outline: 1px solid transparent;
} */