
:root {
    --dark-plum: #3d184c;
    --light-mauve: #f4ebfa;
    --soft-peach: #f5e0ce;
    --lavender-grey: #b6b0b9;
    --faint-steel-blue: #e2e7ef;
    --inactive-grey: #616161;
    --border-black: #141414;
    --std-box-padding: 18px;
    --sb-gap: 0; /* JS calculated */
    --checkbox-row-h: 1.45rem;
    --font-size-standard: 0.95rem;
    --font-size-table-head: 0.93rem;
    --font-size-button: 0.97rem;
    --font-size-navbar: 0.97rem;
    --font-size-group-label: 1.02rem;
    --font-size-tab: 1.1rem;
    --font-size-page-title: 1.6rem;
}

a {
    text-decoration: none;   /* remove underline for links */
    color: inherit;          /* inherit text color from parent */
}

label, input, select, textarea {
    margin: 0;
    padding: 0;
    font: inherit;
    color: inherit;
}

.hidden {
    display: none;
}

.nowrap-measure th, .nowrap-measure td {
    white-space: nowrap;
}

.page-title h1 {
    color: midnightblue;
    margin: 18px 0;
    font-size: var(--font-size-page-title);
    line-height: 1.1;
}

.body-container {
    margin-top: 14px;
    margin-left: 30px;
    max-width: 1600px;
    width: 100%;
}

.navbar {
    width: max-content;
    background-color: var(--faint-steel-blue);
    padding: 2px 12px 4px 10px;
    border: 0.5px solid darkgrey;
    border-radius: 4px;
}
.navbar a {
    color: var(--dark-plum);
    font-size: var(--font-size-navbar);
    text-decoration: none;
    margin-right: 18px;
}
.navbar a:last-child {
    margin-right: 0;
}

.navbar button.btn-link {
    all: unset;
    background-color: transparent;
    color: var(--dark-plum);
    border: none;
    padding: 0;
    cursor: pointer;
}

.content-wrap {
    display: inline-block;
}

header {
    width: fit-content;
}

.tab-container {
    display: flex;
    height: 1.8rem;
}

.tab-button {
    display: flex;
    width: 160px;
    background-color: var(--lavender-grey);
    margin-right: 5px;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    border: 0.5px solid darkgrey;
}
.tab-button:last-child {
    margin-right: 0;
}
.tab-button.current-tab {
    background-color: var(--light-mauve);
    border-bottom: none;
}

.tab-link {
    color: var(--dark-plum);
    text-decoration: none;
}
.tab-link.current-tab {
    font-weight: bold;
}
.tab-link.tab-inactive {}

main {
    display: block;
    min-width: 100%;
    width: fit-content;
    max-width: 100%;
    box-sizing: border-box;
    padding: var(--std-box-padding);
    padding-bottom: calc(var(--std-box-padding) + 2px);
    background-color: var(--light-mauve);
    border: 0.5px solid darkgrey;
}

.action-bar {
    width: fit-content;
    display: flex;
    align-items: center;
    margin: 0 0 var(--std-box-padding) 0;
}
.action-bar-buttons {}
.action-bar-pager {
    text-align: right;
    color: var(--dark-plum);
    margin-left: 30px;
}
.pager-record-count {
    margin: 0 15px;
}
.pager-btn {
    margin: 0 -2px;
}
.pager-page-count {
    margin: 0 3px;
}

button.btn, button.small-btn, button.icon-btn,
a.btn, a.small-btn, a.icon-btn {
    all: unset;              /* wipe browser defaults */
    display: inline-block;   /* so <a> behaves like a box */
    cursor: pointer;         /* both should look clickable */
    text-decoration: none;   /* remove underline on <a> */
    text-align: center;
    box-sizing: border-box;
}

/* Shared button styling */
button.btn, a.btn {
    height: auto;
    border: 1px solid lightslategrey;
    border-radius: 3px;
    margin-right: 2px;
    font-size: var(--font-size-button);
    font-family: inherit;
    padding: 1px 5px 3px 3px;
    color: var(--dark-plum);
    background-color: white;
}
button.no-icon, a.no-icon {
    padding: 2px 5px 4px 4px;
}
button.small-btn, a.small-btn {
    border: 1px solid slategrey;
    border-radius: 4px;
    margin: 0 0 0 1px;
    font-size: var(--font-size-standard);
    background-color: white;
}
button.icon-btn, a.icon-btn {
    font-size: calc(1.15*var(--font-size-standard));
    background-color: transparent;
}

a.btn:focus-visible, a.small-btn:focus-visible, a.icon-btn:focus-visible
button.btn:focus-visible, button.small-btn:focus-visible, button.icon-btn:focus-visible {
    outline: 2px solid black;
    outline-offset: 2px;
    border-radius: 4px;
}

/* icon container */
.icon-copy {
    position: relative;
    font-size: 1em;
    display: inline-block;
    margin-left: -0.1rem;
    margin-right: 0.07rem;
}

/* overlay emoji */
.icon-copy-overlay {
    position: absolute;
    top: 0.1em;
    left: 0.25em;
}

.add-btn, .copy-btn, .delete-btn, .extra-btn, .prefs-btn, .replace-btn, .submit-btn, .view-btn {}

.table-group-container {
    max-height: 710px;
    overflow-y: auto;
    padding-inline-end: var(--sb-gap, 0);
}

.group-label {
    font-size: var(--font-size-group-label);
    font-weight: bold;
    color: indigo;
    margin-bottom: 8px;
    cursor: pointer;
}

.group-label-icon {
    font-size: 0.82rem;
    cursor: pointer;
}

.table-container {
    width: fit-content;
    margin-bottom: 23px;
}
.table-container:last-child {
    margin-bottom: 0;
}

/*        -- Data table styling --        */

table {
    border-collapse: collapse;
    font-size: var(--font-size-standard);
    background-color: white;
}

table thead {
    height: 1.7rem;
    font-weight: bold;
    font-size: var(--font-size-table-head);
    color: #2b1322;
    background-color: lightsteelblue;
    cursor: pointer;
}

th, td {
    border: 1px solid var(--border-black);
}

.col-head-action-cell {
    background-color: var(--light-mauve);
    border-color: var(--light-mauve);
}

table.data-table td.row-action-cell {
    background-color: var(--light-mauve);
    border-color: var(--light-mauve);
    padding: 0 0 0 5px;
}
.row-action-cell search-btn {}
.row-action-cell reset-btn {}

tr.data-inactive {
    color: var(--inactive-grey);
}

td.background-cell {
    background-color: var(--light-mauve);
    border: none;
}

/*        -- DAG tree styling --        */

.dag-tree {
    padding-left: 0;
    list-style: none;
}

.dag-item {
    margin: 4px 0;
    line-height: 1.2rem;
}

.expander {
    display: inline-block;
    width: 0.7rem;
    height: 0.7rem;
    line-height: 0.8rem;   /* centers +/- vertically inside */
    text-align: center;     /* horizontal centering */
    vertical-align: middle; /* centers the box in the line */
    margin-right: 0.25em;
    margin-bottom: 0.1rem;
    user-select: none;
    font-size: 0.75rem;
    border: 1px solid lightgrey;
    cursor: pointer;
    background-color: white;
}
.dag-tree .expander[data-has-children="1"] {
    cursor: pointer;

}
.dag-tree .expander[aria-expanded="false"] {
    /* optional: style when collapsed */
    color: var(--inactive-grey, #666);
}
.dag-tree .expander[data-has-children="0"] {
    color: var(--inactive-grey); /* leaf dot */
}

/*        -- Filter-row styling --        */

/* Compact by default; ellipsis when not focused/expanded */
table.data-table thead tr#filter-row th,
table.data-table thead tr#filter-row td {
    padding: 1px;
}

/* Render borders on vertical neighbor when filter row visible */
table.data-table:not(.filters-visible) thead tr:first-child > th { border-bottom: 0; }
table.data-table.filters-visible thead tr:first-child > th { border-bottom: 1px solid var(--border-black); }
table.data-table.filters-visible tbody > tr:first-of-type > td,
table.data-table.filters-visible tbody > tr.sizer-row + tr > td { border-top: 0; }

#filter-row .filter-cell {
    position: relative;
    padding: 1px;
    overflow: hidden;
    contain: inline-size;
}
#filter-row .filter-input {
    box-sizing: border-box;
    display: block;
    font-size: var(--font-size-standard);
    color: darkblue;
    width: 100%;
    height: 1.5rem;
    padding-left: 3px;
    min-inline-size: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Expanded overlay state (absolute, overlaps neighbors) */
#filter-row .filter-input.expanded {
    position: absolute;
    z-index: 30;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    max-inline-size: none;
    max-width: none;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    background: #fff;
    border-radius: 3px;
    padding: 2px 3px;
}
/* Visually de-emphasize other inputs while one is expanded */
table.data-table.filter-expanded #filter-row .filter-input:not(.expanded) {
    opacity: 0.7;
}
/* Keep overlapped inputs clickable outside the expanded region */
#filter-row th {
    position: relative;
    overflow: visible;
}
#filter-row .filter-cell.overlay-open {
    overflow: visible;
    z-index: 1;
}
#filter-row .filter-row-action-cell {
    border-top: 1px solid var(--border-black) !important;
    border-bottom: 1px solid var(--border-black) !important;
    padding: 0 5px !important;
}

/*        -- Sizer-row styling --        */

table.data-table tr.sizer-row {
    visibility: collapse;
    padding: 0;
}

/*        -- Form styling --        */

.form-field-container {
    display: flex;
    gap: 30px;
}
.form-button {
    margin-top: 10px;
}
.form-column-label {
    font-weight: bold;
    font-size: var(--font-size-standard);
    text-align: center;
    color: midnightblue;
    margin-bottom: 1rem;
}

.form-column {}

.form-field {
    margin: 5px 0 10px 0;
}
.form-field:last-child {
    margin-bottom: 0;
}
.form-field .is-disabled-icon,  .form-field .is-readonly-icon {
    font-size: 0.8rem;
}
.form-field .is-disabled, .form-field .is-readonly {
    opacity: 1;
}
.form-control-label, .sub-table-title {
    display: block;
    font-weight: bold;
    color: indigo;
    margin-bottom: 5px;
}

/* Text-like controls only (single-line inputs, selects, textareas) */
input.form-control:not([type="checkbox"]):not([type="radio"]),
select.form-control, textarea.form-control, .form-logs {
    box-sizing: border-box;
    font-size: var(--font-size-standard);
    height: 1.6rem;
    border-radius: 3px;
    background-color: white;
    border: 1px solid grey;
    padding: 2px 4px;
}

input[type="file"].form-control, select.form-control, textarea.form-control {
    min-height: 1.6rem;
    height: auto;
}

input[type="checkbox"] {
    appearance: none;
    width: 1rem; height: 1rem;
    border: 1px solid var(--border-black);
    border-radius: 3px;
    background: white;
    display: grid; place-items: center;
    line-height: 1;
    padding: 0 0 2px 0.5px;
}

input[type="checkbox"]::after {
    content: "";
    box-sizing: border-box;
    width: 0.65rem; height: 0.4rem;
    border: 2px solid indigo;
    border-top: 0; border-left: 0;
    transform-origin: center;
    transform: rotateY(180deg) rotate(50deg) scale(0);
    transition: transform 120ms ease-in-out;
}

input[type="checkbox"]:checked::after {
    transform: rotateY(180deg) rotate(50deg) scale(1);
}

ul.form-control.checkbox-list {
    list-style: none;
    margin: 0;
    padding: 0.35rem 0.6rem;
    border: 1px solid grey;
    border-radius: 3px;
    background: #fff;
    overflow-y: auto; /* max-height is injected inline using the var */
}

/* Allow scrolling on the list in readonly mode */
.is-readonly .checkbox-list {
  pointer-events: auto;
}
/* Block interaction with the checkboxes in readonly mode */
.is-readonly .checkbox-list input[type="checkbox"] {
  pointer-events: none;
}


/* One row per item */
ul.form-control.checkbox-list > li {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-height: var(--checkbox-row-h);
}

ul.form-control.checkbox-list label,
.checkbox-list-menu label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.checkbox-list-category {
    font-weight: 600;
    font-size: var(--font-size-table-head);
    color: midnightblue;
    margin: 0.3rem 0 0.05rem 0;
}
.checkbox-list-category:first-child { margin-top: 0; }

/* Wrapper & menu positioning */
.checkbox-list-wrap {
    display: inline-flex;
    align-items: flex-start;
    gap: 6px;
}
.checkbox-list-menu-anchor { position: relative; }
.checkbox-list-menu-btn {
    border: 1px solid grey;
    border-radius: 3px;
    color: #51516d;
    background: white; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0.15rem;
}
.checkbox-list-menu {
    position: absolute; top: 0; left: calc(100% + 6px);
    background: var(--faint-steel-blue); border: 1px solid grey; border-radius: 3px;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
    padding: .2rem .6rem; z-index: 10;
    width: max-content; min-width: 0; max-width: 24rem;
    overflow: hidden;
}
.checkbox-list-menu .menu-section { margin-bottom: .5rem; }
.checkbox-list-menu .menu-section strong {
    display: block; font-size: .85rem; color: var(--dark-plum); margin: .25rem 0;
}
.checkbox-list-menu label {
    display: inline-flex;
    align-items: center;
    font-size: 0.93rem;
    gap: 0.37rem;
    white-space: nowrap;
    margin: 0 0.3rem 0 0;
    color: #1b1b2a;
}
/* Normalize checkbox size inside the menu */
.checkbox-list-menu input[type="checkbox"] {
    width: 1rem; height: 1rem;
}

/* Optional: size custom checkboxes off the same var (if you use custom styling) */
ul.form-control.checkbox-list input[type="checkbox"],
.checkbox-list-menu input[type="checkbox"] {
    vertical-align: middle;
    /* width: calc(var(--checkbox-row-h) - 0.5rem);
     height: calc(var(--checkbox-row-h) - 0.5rem); */
}
ul.form-control.disabled { opacity: 0.7; }
ul.form-control .checkbox-dag-item.disabled, ul.form-control .checkbox-tree li.disabled { opacity: 0.6; }

.form-field-error {
    color: red;
    font-size: 0.9rem;
    font-weight: normal;
    margin-left: 4px;
}

.form-logs {
    width: 28rem;
    height: 6.5rem;
    overflow-y: auto;
}

form .left-panel, form .right-panel {}  /*Left / right panel are currently not in use*/

/*        -- Logs styling --        */

.log-entry {
    margin: 3px;
}
.log-entry-timestamp {
    font-size: 0.75rem;
    font-weight: bold;
}
.log-entry-date {
    color: indigo;
}
.log-entry-user {
    margin-left: 2px;
    color: midnightblue;
}
.log-entry-message {
    font-size: 0.85rem;
    font-weight: normal;
    color: black;
    margin-top: 1px;
    margin-left: 6px;
}


.sub-table-title {
    margin: 10px 0px 10px 0px;
}

/* lock column widths based on the JS-generated <colgroup> */
table.data-table {
    width: auto;
    table-layout: fixed;  /* enforce the colgroup widths */
}

/* preserve existing padding */
table.data-table th,
table.data-table td {
    padding: 0 5.5px;
    height: 1.7rem;
}

.col-head-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* arrow & badge hidden by default */
.col-head-sort-order, .col-head-sort-priority {
    visibility: hidden;
}

th.sorted .col-head-sort-order, th.sorted .col-head-sort-priority {
    visibility: visible;
}

.col-head-sort-order {
    width: 15px;
    display: inline-block;
    text-align: left;
    font-size: 0.8em;
    line-height: 1em;
    color: black;
    pointer-events: none
}

.col-head-sort-priority {
    width: 12px;
    display: inline-block;
    text-align: right;
    padding: 1px 2px 0 0;
    color: black;
    font-size: 0.65em;
    pointer-events: none;
}

.flash-container {
    margin-top: 15px;
    color: var(--dark-plum);
}


/*        -- Roster view styling --        */

.cluster-group-container {
    margin-top: 30px;
}
.cluster-container {
    width: 1056px;
    box-sizing: border-box;
    font-size: 0.85rem;
}
.cluster-head-container {
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    height: 1.4rem;
    margin: 15px 0;
    border: 1.3px solid black;
    font-size: 1rem;
    font-weight: bold;
    background-color: lightsteelblue;
}
.cluster-name {}
.cluster-date {}
.cluster-round {}
.cluster-location {}
.cluster-time {}

.roster-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.roster-table-container {
    display: inline-flex;
    align-content: space-evenly;
    flex-wrap: wrap;
    flex-direction: column;
    border: 1.3px solid black;
    box-sizing: border-box;
    background-color: white;
}
.roster-table-label, .roster-message-label {
    display: flex;
    flex-basis: 1.5rem;
    align-items: center;
    padding-left: 10px;
    background-color: var(--soft-peach);
    font-weight: bold;
    border-bottom: 1px solid black;
}

.roster-message-label {
    background-color: lightsteelblue;
}

.candidates-container, .roster-message-container {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
}

.roster-message-container {
    width: 31.8rem;
    height: auto;
    padding: 4px 5px 4px 5px;
    white-space: pre-line;
}

.candidate-container {
    width: 16.25rem;
    text-align: center;
    border-right: 1px solid grey;
    box-sizing: border-box;
}

.candidate-container:last-child {
    border-right: none;
}

.candidate-qualification-assessment {
    padding: 2px;
    border-bottom: 1px solid lightgrey;
}

.candidate-qualification-dossier {
    padding: 2px;
    border-bottom: 1px solid lightgrey;
}

.candidate-assessment {
    padding: 2px;
}
.candidate-name-needs-container {
    display: flex;
    flex-wrap: wrap;
    flex-direction: column;
    border-top: 1px solid grey;
}
.candidate-name-container, .candidate-needs-container {
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
    flex-basis: 2.1rem;
    align-items: center;
    padding-left: 6px;
}
.candidate-needs-container {
    flex-basis: 1.5rem;
}

.candidate-name-container {
    border-bottom: 1px solid lightgrey;
}

.candidate-name-label {
    text-align: left;
    flex: 1;
}
.candidate-name {
    text-align: left;
    font-weight: bold;
    flex: 3;
}
.candidate-needs-label {
    text-align: left;
    flex: 1;
}
.candidate-needs {
    text-align: left;
    flex: 3;
}

/*        -- Tooltip styling --        */

.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 120px;
    background-color: #555;
    color: #fff;
    text-align: center;
    font-size: 0.9rem;
    font-weight: normal;
    padding: 5px 0;
    border-radius: 6px;

    /* Position the tooltip text */
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -60px;

    /* Fade in tooltip */
    opacity: 0;
    transition: opacity 0.3s;
}

/* Tooltip arrow */
.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #555 transparent transparent transparent;
}

/* Show the tooltip text when you mouse over the tooltip container */
.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 0.9;
}

.tooltip-portal {
    position: fixed;
    z-index: 9999;
    max-width: min(280px, 90vw);
    padding: 6px 8px;
    border-radius: 6px;
    background: #555;
    color: #fff;
    font-size: 0.9rem;
    line-height: 1.2;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .2s ease;
}

/* optional: fade if user allows motion */
@media (prefers-reduced-motion: reduce) {
    .tooltip-portal { transition: none; }
}

.tooltip-portal.show {
    opacity: .95;
    visibility: visible;
}

/* Arrow */
.tooltip-portal::after {
    content: "";
    position: absolute;
    border-style: solid;
}

/* Top placement (tooltip above target) */
.tooltip-portal.top::after {
    border-width: 6px 6px 0 6px;
    border-color: #555 transparent transparent transparent;
    bottom: -5px;
    left: var(--arrow-x, 50%);  /* use computed center */
    transform: translateX(-50%); /* center arrow horizontally */
}

/* Bottom placement (tooltip below target) */
.tooltip-portal.bottom::after {
    border-width: 0 6px 6px 6px;
    border-color: transparent transparent #555 transparent;
    top: -6px;
    left: var(--arrow-x, 50%);
    transform: translateX(-50%);
}

/* Hide the in-table tooltip when JS portal is active (keeps a no-JS fallback) */
html.tooltip-portal-enabled .tooltip .tooltiptext {
    display: none !important;
}

/* --- MultiDAGCheckboxField DAG tree right-aligned expander layout --- */
.dag-tree .dag-item > .dag-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.dag-tree .dag-row .expander {
    margin-left: 0.25em;
    margin-right: 0; /* override default left-side spacing */
}


/* --- Menu UX adjustments for checkbox lists --- */

