  /* =========================================================
   Org Chart Wrapper
   ========================================================= */

.org-chart-section {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}

@media (min-width: 1200px) {
  .org-chart-section {
    position: relative;
    left: 50%;
    right: 50%;
    width: 94vw;
    max-width: 1800px;
    margin-left: -47vw;
    margin-right: -47vw;
  }
}

.org-chart {
  width: 100%;
}

.org-loading,
.org-message {
  margin: 1rem 0;
  padding: 1rem;
  background: #f8fafc;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  color: #111827;
}


/* =========================================================
   Screen Reader Utility
   ========================================================= */

.sr-only,
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}


/* =========================================================
   Base Nested List Structure
   ========================================================= */

.org-chart-list,
.org-chart-list ol {
  list-style: none;
  margin: 0;
  padding-left: 0;
}

.org-chart-list {
  padding: 0;
}

.org-node {
  position: relative;
  margin: 0 !important;
  padding: 0 0 1rem 1.5rem;
}

.org-node::before {
  content: "";
  position: absolute;
  left: 0.45rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #cbd5e1;
}

.org-node::after {
  content: "";
  position: absolute;
  left: 0.45rem;
  top: 1.45rem;
  width: 1rem;
  height: 2px;
  background: #cbd5e1;
}

.org-node:last-child::before {
  bottom: calc(100% - 1.45rem);
}

.org-children {
  position: relative;
  margin-top: 0.9rem;
  padding-left: 0;
}

/* Fills the gap between a parent card and its nested child line */
.org-node > .org-children::before {
  content: "";
  position: absolute;
  left: 0.45rem;
  top: -0.9rem;
  width: 2px;
  height: 0.9rem;
  background: #cbd5e1;
}


/* =========================================================
   Root Level Reset
   ========================================================= */

.org-chart-list > .org-node {
  padding-left: 0;
}

.org-chart-list > .org-node::before,
.org-chart-list > .org-node::after {
  display: none;
}


/* =========================================================
   Cards
   ========================================================= */

.org-card {
  width: 100%;
  height: auto;
  border: 0;
  border-left: 0.45rem solid rgba(0, 0, 0, 0.25);
  border-radius: 0.65rem;
  padding: 0.85rem 0.95rem;
  color: #000000;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Top/root card: centered and slightly wider */
.org-chart-list > .org-node > .org-card {
  position: relative;
  max-width: 430px;
  margin-right: auto;
  margin-left: auto;
  padding: 1rem 1.25rem;
}

.org-card__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
}


/* =========================================================
   Level-Based Card Colors
   ========================================================= */

.org-node[data-depth="1"] > .org-card {
  background-color: #cccccc;
  color: #000000;
  text-align: center;
}

.org-node[data-depth="2"] > .org-card {
  background-color: #7facd4;
  color: #000000;
}

.org-node[data-depth="3"] > .org-card {
  background-color: #70ad46;
  color: #000000;
}

.org-node[data-depth="4"] > .org-card {
  background-color: #4473c1;
  color: #000000;
}

/* Fallback for any unexpected deeper levels */
.org-node[data-depth="5"] > .org-card,
.org-node[data-depth="6"] > .org-card,
.org-node[data-depth="7"] > .org-card {
  background-color: #e5e7eb;
  color: #000000;
}


/* =========================================================
   Tablet Layout
   ========================================================= */

@media (min-width: 768px) {
  /*
    Root card centered line.
    This line touches the top/root card and connects to the second-level row.
  */
  .org-chart-list > .org-node > .org-card::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 100%;
    width: 2px;
    height: 1.5rem;
    background: #cbd5e1;
    transform: translateX(-50%);
  }

  /*
    Second level layout.
    The second level starts as 2 columns on tablet.
  */
  .org-chart-list > .org-node > .org-children {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
  }

  /*
    Horizontal line connecting all second-level children.
  */
  .org-chart-list > .org-node > .org-children::before {
    content: "";
    position: absolute;
    top: 0;
    left: 8%;
    right: 8%;
    width: auto;
    height: 2px;
    background: #cbd5e1;
  }

  /*
    Second-level cards sit in the grid.
  */
  .org-chart-list > .org-node > .org-children > .org-node {
    padding: 0;
  }

  .org-chart-list > .org-node > .org-children > .org-node::before {
    display: none;
  }

  /*
    Vertical line from the horizontal connector down to each second-level card.
    This now touches the card.
  */
  .org-chart-list > .org-node > .org-children > .org-node::after {
    display: block;
    left: 50%;
    top: -1.25rem;
    width: 2px;
    height: 1.25rem;
    transform: translateX(-50%);
    background: #cbd5e1;
  }

  /*
    Third level below second level.
  */
  .org-chart-list > .org-node > .org-children > .org-node > .org-children {
    display: block;
    margin-top: 0.9rem;
    padding-left: 0;
  }

  .org-chart-list > .org-node > .org-children > .org-node > .org-children::before {
    content: "";
    position: absolute;
    left: 0.45rem;
    top: -0.9rem;
    width: 2px;
    height: 0.9rem;
    background: #cbd5e1;
  }

  .org-chart-list > .org-node > .org-children > .org-node > .org-children > .org-node {
    padding: 0 0 1rem 1.5rem;
  }

  .org-chart-list > .org-node > .org-children > .org-node > .org-children > .org-node::before {
    display: block;
  }

  .org-chart-list > .org-node > .org-children > .org-node > .org-children > .org-node::after {
    display: block;
    left: 0.45rem;
    top: 1.45rem;
    width: 1rem;
    height: 2px;
    transform: none;
    background: #cbd5e1;
  }

  /*
    Fourth level below third level.
    This keeps the same margin and connector behavior as the other nested levels.
  */
  .org-node[data-depth="3"] > .org-children {
    position: relative;
    display: block;
    margin-top: 0.9rem;
    padding-left: 0;
  }

  .org-node[data-depth="3"] > .org-children::before {
    content: "";
    position: absolute;
    left: 0.45rem;
    top: -0.9rem;
    width: 2px;
    height: 0.9rem;
    background: #cbd5e1;
  }

  .org-node[data-depth="3"] > .org-children > .org-node {
    padding: 0 0 1rem 1.5rem;
  }

  .org-node[data-depth="3"] > .org-children > .org-node::before {
    display: block;
  }

  .org-node[data-depth="3"] > .org-children > .org-node::after {
    display: block;
    left: 0.45rem;
    top: 1.45rem;
    width: 1rem;
    height: 2px;
    transform: none;
    background: #cbd5e1;
  }
}


/* =========================================================
   Medium Desktop Layout
   ========================================================= */

@media (min-width: 992px) {
  .org-chart-list > .org-node > .org-children {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}


/* =========================================================
   Large Desktop Layout: 6 Even Second-Level Columns
   ========================================================= */

@media (min-width: 1200px) {
  .org-chart-list > .org-node > .org-children {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1rem;
  }
}