/* Look and feel come from the Bootswatch Cosmo theme; only theme variables (--bs-*) are used here,
   so every rule works in the light and the dark color mode (data-bs-theme on <html>). */

html {
    font-size: 15px;
}

body {
    background: var(--bs-tertiary-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1 0 auto;
}

/* ---- Sticky top menu that shrinks on scroll (site.js toggles .navbar-shrink) ---- */
.navbar-kh {
    padding-top: .9rem;
    padding-bottom: .9rem;
    transition: padding .2s ease, box-shadow .2s ease;
}

.navbar-kh .brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: var(--bs-primary);
    font-weight: 700;
    width: 3rem;
    height: 2.4rem;
    font-size: 1rem;
    transition: all .2s ease;
}

.navbar-kh .brand-name {
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: .02em;
    transition: font-size .2s ease;
}

.navbar-kh.navbar-shrink {
    padding-top: .25rem;
    padding-bottom: .25rem;
    box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .25);
}

.navbar-kh.navbar-shrink .brand-mark {
    width: 2.3rem;
    height: 1.7rem;
    font-size: .75rem;
}

.navbar-kh.navbar-shrink .brand-name {
    font-size: 1.05rem;
}

.navbar-kh .nav-link.active {
    box-shadow: inset 0 -2px 0 rgba(255, 255, 255, .85);
}

.theme-toggle {
    border: 0;
}

.user-menu {
    min-width: 16rem;
}

.footer-kh {
    color: var(--bs-secondary-color);
    font-size: .85rem;
    padding: 1rem 0;
    border-top: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
}

/* ---- Page elements ---- */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1.25rem;
}

.page-header h1 {
    font-size: 1.6rem;
    color: var(--bs-emphasis-color);
    margin: 0;
}

.page-header .subtitle {
    color: var(--bs-secondary-color);
    font-size: .95rem;
}

.card-header {
    font-weight: 600;
    color: var(--bs-emphasis-color);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--bs-primary);
}

.stat-card a {
    text-decoration: none;
    color: inherit;
}

.stat-card:hover {
    border-color: var(--bs-primary);
}

.table > :not(caption) > * > * {
    vertical-align: middle;
}

.validation-summary-valid {
    display: none;
}

.field-validation-error {
    color: var(--bs-danger);
    font-size: .875rem;
}

.input-validation-error {
    border-color: var(--bs-danger);
}

/* ---- Item tree ---- */
.item-tree,
.item-tree ul {
    list-style: none;
    margin: 0;
    padding-left: 1.4rem;
}

.item-tree {
    padding-left: 0;
}

.item-tree li {
    position: relative;
    padding: .2rem 0;
}

.item-tree ul > li::before {
    content: "";
    position: absolute;
    left: -.9rem;
    top: 0;
    bottom: 50%;
    width: .7rem;
    border-left: 1px solid var(--bs-border-color);
    border-bottom: 1px solid var(--bs-border-color);
}

.item-tree .item-ci {
    color: var(--bs-secondary-color);
    font-size: .85rem;
}

/* ---- Integration diagram (maxGraph) ---- */
/* Follows the color mode; integration-diagram.js switches the node and line colors along */
.diagram-canvas {
    --diagram-grid-dot: #d5deea;
    position: relative;
    overflow: auto;
    height: 560px;
    background-color: var(--bs-body-bg);
    background-image: radial-gradient(var(--diagram-grid-dot) 1px, transparent 1px);
    background-size: 16px 16px;
    border: 1px solid var(--bs-border-color);
    cursor: default;
}

[data-bs-theme=dark] .diagram-canvas {
    --diagram-grid-dot: rgba(255, 255, 255, .12);
}

.diagram-canvas.read-only {
    height: 420px;
}

.diagram-palette {
    max-height: 560px;
    overflow-y: auto;
}

.diagram-palette .palette-item {
    cursor: grab;
    user-select: none;
}

/* Already drawn on the diagram */
.diagram-palette .palette-item.used .palette-name::after {
    content: " \2713";
    color: var(--bs-success);
}

/* Shown only as the parent of a filter match */
.diagram-palette .palette-item.palette-context {
    opacity: .55;
}

.remark {
    border-left: 3px solid var(--bs-primary);
    padding-left: .75rem;
}

.remark .remark-text {
    white-space: pre-wrap;
}

pre.json {
    font-size: .75rem;
    max-height: 10rem;
    overflow: auto;
    margin: 0;
    white-space: pre-wrap;
}

@media (max-width: 991.98px) {
    .navbar-kh .navbar-collapse {
        max-height: calc(100vh - 4rem);
        overflow-y: auto;
    }

    .diagram-canvas {
        height: 420px;
    }
}
