:root {
    --primary: #165d53;
    --primary-hover: #224c44;
    --accent: #963e25;
    --accent-soft: #fff0e9;
    --surface: #fff;
    --surface-subtle: #edf4f1;
    --surface-hover: #eef6f3;
    --rule: #dbe6e1;
    --control-border: #b3c6be;
    --dim: #546760;
    --bs-primary: var(--primary);
    --bs-primary-rgb: 22, 93, 83;
    --bs-info: var(--accent);
    --bs-info-rgb: 150, 62, 37;
    --bs-body-bg: #f4f7f6;
    --bs-body-color: #23332f;
    --bs-border-color: var(--rule);
    --bs-secondary-color: var(--dim);
    --bs-light-rgb: 237, 244, 241;
}

body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
[hidden] { display: none !important; }
a { color: var(--primary); }
a:hover, a:focus { color: var(--accent); }
:is(button, a, input, select):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary-hover); --bs-btn-hover-border-color: var(--primary-hover); --bs-btn-active-bg: var(--accent); --bs-btn-active-border-color: var(--accent); }
.btn-outline-primary { --bs-btn-color: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary-hover); --bs-btn-hover-border-color: var(--primary-hover); --bs-btn-active-bg: var(--accent); --bs-btn-active-border-color: var(--accent); }
.btn-light { --bs-btn-bg: var(--surface-subtle); --bs-btn-color: var(--bs-body-color); }
.btn-outline-secondary { --bs-btn-color: var(--dim); --bs-btn-border-color: var(--control-border); }
.btn-light:hover, .btn-outline-secondary:hover { color: #fff; background: var(--primary-hover); border-color: var(--primary-hover) !important; }
.pagination { --bs-pagination-bg: var(--surface); --bs-pagination-color: var(--primary); --bs-pagination-hover-color: var(--accent); --bs-pagination-focus-color: var(--accent); --bs-pagination-active-bg: var(--primary); --bs-pagination-active-border-color: var(--primary); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--primary); }
.form-control, .form-select { background-color: var(--surface); border-color: var(--control-border); }
.form-control:focus, .form-select:focus { background-color: var(--surface); border-color: var(--primary); box-shadow: 0 0 0 .25rem #165d5324; }
.card { --bs-card-bg: var(--surface); }
.brand-accent { color: var(--accent); }
.directory-bar { min-height: 4rem; background: #153e3a; box-shadow: 0 2px 12px #153e3a24; }
.directory-bar :is(a, button):focus-visible { outline-color: #ffd7c8; }
.directory-bar .navbar-brand { min-height: 2.5rem; padding-block: 0; line-height: 1; color: white; }
.directory-bar .navbar-collapse { align-items: center; }
.directory-bar .nav-link { display: inline-flex; align-items: center; min-height: 2.5rem; color: white; padding: 0 .75rem; line-height: 1; border-radius: 8px; }
.directory-bar .nav-link:hover, .directory-bar .nav-link:focus-visible { color: #fff; background: #ffffff1f; }
.directory-bar .navbar-toggler { color: white; }
.directory-main { padding-top: 2rem; padding-bottom: 3rem; }
.contact-heading .bi { display: inline-block; flex: 0 0 24px; font-size: 24px; line-height: 1; }
.contact-table-shell { overflow: auto; }
.contact-table { margin-bottom: 1rem; --bs-table-bg: var(--surface); --bs-table-hover-bg: var(--surface-subtle); }
.contact-table td a { color: var(--primary); text-decoration: none; }
.contact-table td a:hover { color: var(--accent); }
.contact-name { font-size: 1.05rem; overflow-wrap: anywhere; }
.contact-role { line-height: 1.2; overflow-wrap: anywhere; }
.contact-table .org-col { width: 30%; font-size: .95rem; line-height: 1.2; }
.contact-table .org-col a { color: var(--primary) !important; }
.contact-table .phone-col { width: 20%; }
.contact-table .email-col { width: 8%; }
.portrait { display: inline-block; flex-shrink: 0; width: var(--avatar-size, 2.5rem); height: var(--avatar-size, 2.5rem); border-radius: 50%; object-fit: cover; }
.portrait-photo { background: url("/assets/staff-portraits.png") var(--photo-x) var(--photo-y) / 600% 600% no-repeat; }
.photo-x0 { --photo-x: 0%; }
.photo-x1 { --photo-x: 20%; }
.photo-x2 { --photo-x: 40%; }
.photo-x3 { --photo-x: 60%; }
.photo-x4 { --photo-x: 80%; }
.photo-x5 { --photo-x: 100%; }
.photo-y0 { --photo-y: 0%; }
.photo-y1 { --photo-y: 20%; }
.photo-y2 { --photo-y: 40%; }
.photo-y3 { --photo-y: 60%; }
.photo-y4 { --photo-y: 80%; }
.photo-y5 { --photo-y: 100%; }

.directory-panel, .employee-tile { background: white; border: 1px solid var(--rule); border-radius: 8px; box-shadow: 0 8px 24px #2125290f; }
.directory-panel { overflow: hidden; }
.organization-entry, .employee-entry { display: grid; align-items: center; gap: 1rem; padding: .9rem 1rem; }
.organization-entry + .organization-entry, .employee-entry + .employee-entry { border-top: 1px solid var(--rule); }
.organization-entry { grid-template-columns: minmax(0, 1fr) auto; }
.employee-entry { grid-template-columns: minmax(0, 1.3fr) minmax(0, .95fr) minmax(0, .8fr); }
:is(.organization-entry, .employee-entry):hover { background: var(--surface-hover); }
.directory-identity { color: #212529; font-weight: 700; overflow-wrap: anywhere; text-decoration: none; min-width: 0; }
.directory-identity .portrait { --avatar-size: 2.75rem; }
.organization-symbol { display: grid; place-items: center; flex: none; width: 2.75rem; height: 2.75rem; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 1.35rem; }
.view-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem; }
.switcher .btn { min-width: 2.4rem; min-height: 2.4rem; display: inline-grid; place-items: center; }
.company-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.company-head h2 { line-height: 1.15; overflow-wrap: anywhere; }
.employee-tile { display: flex; flex-direction: column; min-height: 15.5rem; height: 100%; gap: 1rem; padding: 1.25rem; }
.employee-tile .portrait { --avatar-size: 4rem; }
.employee-link { display: flex; align-items: flex-start; gap: .55rem; overflow-wrap: anywhere; min-width: 0; font-size: .9rem; }
.employee-link .bi { color: var(--accent); }
.employee-tile .view-actions { margin-top: auto; }
.profile-panel { width: min(1280px, calc(100vw - 2rem)); max-width: none; position: relative; left: 50%; transform: translateX(-50%); }
.profile-head { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 1.25rem; padding: 1.5rem; border-bottom: 1px solid var(--rule); }
.profile-head .portrait { --avatar-size: 5rem; border: 1px solid var(--rule); }
.profile-heading { flex: 1 1 20rem; min-width: 0; padding-top: .25rem; }
.profile-heading h1 { margin: 0; color: #3c4142; font-size: 1.6rem; font-weight: 600; overflow-wrap: anywhere; }
.profile-heading p { margin: .35rem 0 0; color: var(--dim); font-size: .95rem; }
.profile-head .view-actions { flex: 0 1 34rem; margin-left: auto; }
.profile-body { display: grid; grid-template-columns: minmax(260px, .65fr) minmax(0, 2.35fr); align-items: start; }
.profile-rail { border-right: 1px solid var(--rule); background: var(--surface-subtle); }
.profile-body > *, .profile-org { padding: 1.5rem; }
.profile-panel h2 { margin: 0 0 .9rem; color: #3c4142; font-size: .95rem; font-weight: 600; }
.profile-rail section + section { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.profile-body dt { color: var(--dim); font-size: .76rem; text-transform: uppercase; }
.profile-body dd { color: #3c4142; font-size: .92rem; overflow-wrap: anywhere; }
.profile-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 2rem; max-width: 760px; }
.profile-org { border-top: 1px solid var(--rule); }
.chart-area { max-width: 100%; min-height: 20rem; height: 65vh; overflow: auto; cursor: grab; }
.directory-main:has(.wide-chart) { max-width: none; padding-inline: 0; }
.wide-chart .company-head { padding: 0 1.5rem 1rem; margin-bottom: 0; border-bottom: 1px solid var(--rule); }
.chart-area.company-chart { height: 85vh; background: var(--surface-subtle); padding: 1.25rem; }
.chart-area.dragging { cursor: grabbing; user-select: none; }
.chart { display: grid; justify-items: center; width: max-content; min-width: 100%; padding: 1rem 1.25rem 2rem; }
.chart-group { display: flex; justify-content: center; list-style: none; padding: 0; margin: 0; }
.chart-branch { display: grid; justify-items: center; align-content: start; position: relative; padding: 1.35rem .5rem 0; }
.chart-branch::before { content: ""; position: absolute; inset: 0 0 auto; border-top: 2px solid var(--accent); }
.chart-branch:first-child::before { left: 50%; }
.chart-branch:last-child::before { right: 50%; }
.chart-branch:only-child::before { display: none; }
.chart-branch::after { content: ""; position: absolute; top: 0; left: 50%; height: 1.35rem; border-left: 2px solid var(--accent); }
.chart-branch > .chart-group, .chart-root + .chart-group { position: relative; margin-top: 1.35rem; }
.chart-branch > .chart-group::before, .chart-root + .chart-group::before { content: ""; position: absolute; bottom: 100%; left: 50%; height: 1.35rem; border-left: 2px solid var(--accent); }
.chart-root { border-radius: 8px; padding: 1.25rem; min-width: 250px; max-width: 18rem; background: var(--primary); color: #fff; text-align: center; overflow-wrap: anywhere; }
.chart-person { display: grid; place-items: center; align-content: start; width: 180px; min-height: 139px; gap: .3rem; padding: .85rem .6rem; border: 2px solid transparent; border-radius: 8px; box-shadow: 0 2px 6px #00000014; background: #fff; text-align: center; text-decoration: none; color: #212529; overflow-wrap: anywhere; }
.chart-person:hover, .chart-person.active { border-color: var(--accent); color: var(--primary); }
.chart-person.active { background: var(--accent-soft); }
.chart-person .portrait { --avatar-size: 3.75rem; border: 2px solid var(--rule); }
.chart-person strong { font-size: 14px; }
.chart-person small { font-size: 11px; color: var(--dim); }
.chart-team { margin-top: .5rem; text-align: center; }
.chart-team summary { width: max-content; margin-inline: auto; cursor: pointer; }

@media (max-width: 991.98px) {
    .company-head { flex-direction: column; }
    .company-head .view-actions, .organization-entry .view-actions { justify-content: flex-start; }
    .organization-entry, .employee-entry { grid-template-columns: 1fr; gap: .55rem; }
    .profile-body { grid-template-columns: 1fr; }
    .profile-rail { border-right: 0; border-bottom: 1px solid var(--rule); }
    .profile-head .view-actions { flex-basis: 100%; justify-content: flex-start; margin-left: 0; }
}
@media (max-width: 575.98px) {
    .contact-table .contact-name, .contact-table .contact-role { overflow-wrap: normal; }
    .profile-head, .profile-body > *, .profile-org { padding: 1.15rem; }
    .profile-head .portrait { --avatar-size: 4rem; }
    .profile-heading { flex-basis: 10rem; }
    .profile-heading h1 { font-size: 1.3rem; }
    .profile-fields { grid-template-columns: 1fr; }
}
