* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; background: #f4f6f8; color: #202733; }
header { background: #172a3a; color: white; padding: 1rem 2rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.brand { font-size: 1.25rem; font-weight: 700; }
nav { display: flex; gap: .75rem; flex-wrap: wrap; }
nav a { color: white; text-decoration: none; padding: .5rem .75rem; border-radius: .4rem; }
nav a:hover { background: rgba(255,255,255,.12); }
main { max-width: 95%; margin: 0 auto; padding: 2rem; }
h1, h2 { margin-top: 0; }
.hero, .page-heading { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; margin-bottom: 2rem; flex-wrap: wrap; }
.hero { background: white; padding: 2rem; border-radius: 1rem; box-shadow: 0 5px 20px rgba(0,0,0,.06); }
.actions, .form-actions, .chart-controls { display: flex; gap: .75rem; flex-wrap: wrap; }
.button { display: inline-block; border: 0; cursor: pointer; background: #1b6ca8; color: white; text-decoration: none; padding: .75rem 1rem; border-radius: .45rem; font-weight: 700; }
.button:hover { filter: brightness(.94); }
.button.secondary { background: #e7edf2; color: #243240; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 2rem; }
.stat, .card, .form-card, .empty { background: white; padding: 1.5rem; border-radius: .8rem; box-shadow: 0 4px 16px rgba(0,0,0,.05); }
.stat strong { display: block; font-size: 2rem; color: #1b6ca8; }
.stat span { color: #687381; }
.empty { text-align: center; padding: 3rem; }
.table-wrap { overflow-x: auto; background: white; border-radius: .8rem; box-shadow: 0 4px 16px rgba(0,0,0,.05); }
table { width: 100%; border-collapse: collapse; min-width: 850px; }
th, td { padding: 1rem; text-align: left; border-bottom: 1px solid #e7ebef; }
th { background: #f7f9fb; }
.row-actions { display: flex; align-items: center; gap: .75rem; }
.row-actions form { margin: 0; }
.row-actions a, .link-danger { background: none; border: none; padding: 0; cursor: pointer; color: #1b6ca8; font: inherit; text-decoration: none; }
.link-danger { color: #b42318; }
.badge { display: inline-block; padding: .25rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.badge.filled { background: #dff5e5; color: #146c2e; }
.badge.vacant { background: #fff0d8; color: #9a5a00; }
.form-card { max-width: 900px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
label { display: flex; flex-direction: column; gap: .45rem; font-weight: 700; }
input, select { width: 100%; padding: .75rem; border: 1px solid #cbd5df; border-radius: .45rem; background: white; font: inherit; }
.form-actions { margin-top: 1.5rem; }
.flash { padding: 1rem; border-radius: .5rem; margin-bottom: 1rem; }
.flash.success { background: #dff5e5; color: #146c2e; }
.flash.error { background: #fde7e7; color: #a61b1b; }
#chart-viewport { height: 72vh; min-height: 600px; overflow: hidden; background: #fff; border-radius: .8rem; box-shadow: 0 4px 16px rgba(0,0,0,.07); position: relative; }
#chart-canvas { position: relative; transform-origin: 0 0; min-width: 100%; min-height: 100%; padding: 50px; }
#connectors { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 1; }
.connector { stroke: #98a6b5; stroke-width: 2; fill: none; }
#chart { position: relative; z-index: 2; display: flex; justify-content: center; min-width: max-content; }
.tree { display: flex; justify-content: center; }
.tree ul {
    padding-top: 35px;
    position: relative;
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 0;
    padding-left: 10px;
    padding-right: 10px;
    list-style: none;
}

.tree ul.lower-level-list {
    display: grid;
    grid-template-columns: repeat(3, 170px);
    justify-content: center;
    column-gap: 25px;
    row-gap: 30px;
}

.tree ul.lower-level-list {
    display: grid;
    grid-template-columns: repeat(3, 170px);
    justify-content: center;
    column-gap: 25px;
    row-gap: 30px;
}

.tree li { text-align: center; position: relative; }
.node {
    width: 170px;
    min-height: 85px;
    background: white;
    border: 2px solid #cbd5df;
    border-radius: .7rem;
    padding: .7rem;
    cursor: grab;
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
    transition: transform .15s, border-color .15s, box-shadow .15s;
}

/* Dean and Department Chairs stay large */
.node.leadership-node {
    width: 220px;
    min-height: 125px;
    padding: 1rem;
    background:rgb(210, 231, 210);
}

.node-title {
    font-weight: 800;
    font-size: .9rem;
}

.node-name {
    margin-top: .3rem;
    font-size: .82rem;
}

.node-meta {
    margin-top: .35rem;
    font-size: .7rem;
}

/* Larger text for Dean and Department Chairs */
.node.leadership-node .node-title {
    font-size: 1rem;
}

.node.leadership-node .node-name {
    margin-top: .45rem;
    font-size: .95rem;
}

.node.leadership-node .node-meta {
    margin-top: .5rem;
    font-size: .78rem;
}
.node:hover { transform: translateY(-2px); border-color: #1b6ca8; }
.node.dragging { opacity: .45; }
.node.drop-target { border-color: #1b6ca8; box-shadow: 0 0 0 4px rgba(27,108,168,.15); }
.node-title { font-weight: 800; font-size: 1rem; }
.node-name { margin-top: .45rem; font-size: .95rem; }
.node-meta { margin-top: .5rem; font-size: .78rem; color: #687381; }
.node.vacant .node-name { color: #9a5a00; font-weight: 700; }
.chart-help { margin-top: 1rem; color: #52606d; }
@media (max-width: 700px) {
  main { padding: 1rem; }
  .stats, .form-grid { grid-template-columns: 1fr; }
  header { padding: 1rem; }
  #chart-viewport { height: 75vh; min-height: 500px; }
}

.node.drop-target {
border:1px solid black;
}

.node.drop-before {
    box-shadow: -6px 0 0 0 #3391e9;
}

.node.drop-after {
    box-shadow: 6px 0 0 0 #3391e9;
}

.node.dragging {
    opacity: 0.45;
    cursor: grabbing;
}

.adminsac{
user-select:none;}

.adminoffice{
display:inline-block;
border:1px solid rgb(160, 139, 139);
padding:10px;
border-radius:10px;
font-size:12px;}

#chart-viewport {
    position: relative;
    overflow: hidden;
    cursor: grab;
    width: 100%;
    height: 75vh;
}

#chart-viewport.panning {
    cursor: grabbing;
}

#chart-canvas {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    will-change: transform;
}

#chart-viewport .node {
    cursor: grab;
}

#chart-viewport .node.dragging {
    cursor: grabbing;
}

.checkbox-field {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.checkbox-field input[type="checkbox"] {
    width: 20px;
    height: 20px;
}