/* ===================================================================
   Org Chart — Admin Panel  (Brandworks orange / white theme)
   =================================================================== */
:root {
  --brand:#f26522; --brand-dark:#d4521a; --brand-soft:#fff1e8;
  --charcoal:#3a3d42; --ink:#2f3338; --muted:#9a8b7f;
  --exec:#e02516; --position:#3258c4; --support:#c4641d;
  --line:#ecdccd;
}
* { box-sizing:border-box; }
[hidden] { display:none !important; }
html,body{margin:0;height:100%;font-family:"Segoe UI",system-ui,Arial,sans-serif;color:var(--ink);
  background:linear-gradient(135deg,#fffaf6,#fdeee3);}

/* ---------- Login ---------- */
.login-screen{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:20px;}
.login-card{background:#fff;border-radius:16px;padding:34px 30px;width:350px;max-width:92vw;
  box-shadow:0 18px 50px rgba(210,110,40,.18);text-align:center;border-top:4px solid var(--brand);}
.login-logo{height:42px;margin-bottom:14px;}
.login-card h2{margin:0;font-size:20px;color:var(--charcoal);}
.login-sub{margin:4px 0 18px;font-size:12.5px;color:var(--muted);}
.login-card input{width:100%;padding:11px 13px;border:1.5px solid #e6d3c3;border-radius:10px;font-size:14px;outline:none;}
.login-card input:focus{border-color:var(--brand);box-shadow:0 0 0 3px rgba(242,101,34,.16);}
.login-card button{width:100%;margin-top:14px;padding:11px;border:none;border-radius:10px;cursor:pointer;
  background:linear-gradient(180deg,var(--brand),var(--brand-dark));color:#fff;font-size:15px;font-weight:700;}
.login-card button:hover{filter:brightness(1.05);}
.login-err{color:#d0392b;font-size:13px;min-height:18px;margin:12px 0 0;}

/* ---------- Shell ---------- */
.admin-shell{height:100vh;display:flex;flex-direction:column;}
.admin-header{display:flex;align-items:center;gap:16px;background:#fff;padding:12px 22px;flex-shrink:0;
  box-shadow:0 3px 14px rgba(210,110,40,.10);border-bottom:3px solid var(--brand);z-index:2;}
.admin-logo{height:36px;}
.admin-title{display:flex;flex-direction:column;line-height:1.15;border-left:2px solid #eee0d5;padding-left:16px;}
.admin-title strong{font-size:16px;color:var(--charcoal);}
.admin-title span{font-size:12px;color:var(--brand);font-weight:600;}
.header-spacer{flex:1;}
.ghost-btn{border:1.5px solid #e6d3c3;background:#fff;border-radius:9px;padding:8px 14px;font-size:13px;
  font-weight:600;color:var(--charcoal);text-decoration:none;cursor:pointer;white-space:nowrap;}
.ghost-btn:hover{background:var(--brand-soft);border-color:var(--brand);color:var(--brand-dark);}

.admin-body{flex:1;display:flex;min-height:0;}

/* ---------- Sidebar ---------- */
.side{width:256px;flex-shrink:0;background:#fff;border-right:1px solid var(--line);
  padding:18px 14px;display:flex;flex-direction:column;gap:12px;overflow:auto;}
.side-head{font-size:11.5px;font-weight:700;text-transform:uppercase;letter-spacing:.7px;color:var(--muted);padding:0 6px;}
.dept-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:5px;flex:1;}
.dept-item{display:flex;align-items:center;gap:8px;padding:11px 13px;border-radius:10px;cursor:pointer;
  border:1px solid #f1e4d8;transition:all .12s;}
.dept-item:hover{background:var(--brand-soft);border-color:#f3d3bd;}
.dept-item.active{background:linear-gradient(180deg,var(--brand),var(--brand-dark));border-color:var(--brand-dark);
  box-shadow:0 4px 12px rgba(242,101,34,.3);}
.dept-item .d-name{flex:1;font-weight:600;font-size:14px;color:var(--charcoal);}
.dept-item.active .d-name{color:#fff;}
.dept-item .d-count{font-size:11px;font-weight:700;background:#f3ece5;color:var(--muted);
  border-radius:20px;padding:2px 9px;}
.dept-item.active .d-count{background:rgba(255,255,255,.28);color:#fff;}

/* ---------- Main ---------- */
.main{flex:1;display:flex;flex-direction:column;min-width:0;}
.main-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;flex-wrap:wrap;
  padding:18px 24px;border-bottom:1px solid var(--line);background:rgba(255,255,255,.65);flex-shrink:0;}
.main-head h2{margin:0;font-size:19px;color:var(--charcoal);}
.meta{margin:5px 0 0;font-size:12.5px;color:var(--muted);}
.meta b{color:var(--charcoal);}
.meta .pill{display:inline-block;margin-left:6px;padding:1px 8px;border-radius:20px;font-size:11px;font-weight:700;}
.meta .pill.vac{background:#fdeceb;color:#c5372a;} .meta .pill.new{background:#e9f0fd;color:#2f6fe0;}
.main-actions{display:flex;gap:8px;flex-wrap:wrap;}

.btn{border:1.5px solid #e6d3c3;background:#fff;border-radius:9px;padding:8px 14px;font-size:13px;font-weight:600;
  color:var(--charcoal);cursor:pointer;transition:all .14s;white-space:nowrap;}
.btn:hover{background:var(--brand-soft);border-color:var(--brand);color:var(--brand-dark);}
.btn.primary{background:linear-gradient(180deg,var(--brand),var(--brand-dark));color:#fff;border-color:var(--brand-dark);}
.btn.primary:hover{filter:brightness(1.06);color:#fff;}
.btn.danger{color:#c5372a;border-color:#f0c7c1;}
.btn.danger:hover{background:#fdeceb;border-color:#d0392b;color:#b62b1f;}
.btn.block{width:100%;text-align:center;}

/* ---------- Tree ---------- */
.tree-wrap{flex:1;overflow:auto;padding:22px 24px;}
.tree-toolbar{display:flex;gap:8px;margin-bottom:6px;}
.mini-btn{border:1.5px solid #e6d3c3;background:#fff;border-radius:8px;padding:6px 12px;font-size:12px;
  font-weight:600;color:var(--charcoal);cursor:pointer;}
.mini-btn:hover{background:var(--brand-soft);border-color:var(--brand);color:var(--brand-dark);}

/* collapse / expand */
li.collapsed > ul{display:none;}
.t-toggle{width:22px;height:22px;flex-shrink:0;border:1.5px solid #e6d3c3;background:#fff;border-radius:6px;
  cursor:pointer;font-size:15px;font-weight:700;line-height:1;color:var(--brand-dark);
  display:flex;align-items:center;justify-content:center;padding:0;}
.t-toggle:hover{background:var(--brand-soft);border-color:var(--brand);}
.t-toggle-spacer{width:22px;flex-shrink:0;}
#tree ul{list-style:none;margin:0;padding-left:30px;position:relative;}
#tree ul::before{content:"";position:absolute;left:12px;top:0;bottom:18px;border-left:2px dashed #e6d2c1;}
#tree > .root-list{padding-left:0;}
#tree > .root-list::before{display:none;}
#tree li{position:relative;}
#tree ul li::after{content:"";position:absolute;left:-18px;top:24px;width:18px;border-top:2px dashed #e6d2c1;}
.tree-row{display:flex;align-items:center;gap:11px;background:#fff;border:1px solid #efe0d2;border-radius:10px;
  padding:10px 13px;margin:7px 0;box-shadow:0 1px 3px rgba(58,61,66,.06);position:relative;}
.tree-row:hover{border-color:var(--brand);box-shadow:0 4px 13px rgba(242,101,34,.14);}
.t-dot{width:11px;height:11px;border-radius:3px;flex-shrink:0;}
.t-dot.exec{background:var(--exec);} .t-dot.position{background:var(--position);} .t-dot.support{background:var(--support);}
.t-name{font-weight:700;font-size:13.5px;color:var(--charcoal);}
.t-person{font-size:12px;color:var(--muted);}
.t-badge{font-size:10px;font-weight:700;padding:2px 8px;border-radius:20px;text-transform:uppercase;letter-spacing:.3px;}
.badge-normal{background:#e7f6ee;color:#1f8a4c;}
.badge-notice{background:#fdf2db;color:#a9791a;}
.badge-hold{background:#eef0f2;color:#6c727b;}
.badge-vacant{background:#fdeceb;color:#c5372a;}
.badge-new{background:#e9f0fd;color:#2f6fe0;}
.t-link{font-size:11px;font-weight:600;color:var(--brand-dark);background:var(--brand-soft);
  border:1px solid #f3d3bd;border-radius:20px;padding:2px 9px;white-space:nowrap;}
.t-spacer{flex:1;}
.t-actions{display:flex;gap:6px;opacity:.85;transition:opacity .12s;}
.tree-row:hover .t-actions{opacity:1;}
.icon-btn{border:1px solid #e6d3c3;background:#fff;border-radius:7px;padding:5px 9px;font-size:12px;font-weight:600;
  color:var(--charcoal);cursor:pointer;}
.icon-btn:hover{background:var(--brand-soft);border-color:var(--brand);color:var(--brand-dark);}
.icon-btn.del:hover{background:#fdeceb;border-color:#d0392b;color:#b62b1f;}
.icon-btn.mv{padding:5px 7px;font-size:10px;line-height:1;}
.empty-note{color:var(--muted);font-size:14px;padding:30px;text-align:center;
  border:1.5px dashed #f0cdb2;border-radius:12px;background:#fff;margin-top:10px;}
.empty-note b{color:var(--charcoal);}

/* ---------- Modal ---------- */
.modal{position:fixed;inset:0;background:rgba(40,30,20,.42);display:flex;align-items:center;justify-content:center;
  padding:20px;z-index:50;}
.modal-card{background:#fff;border-radius:14px;padding:24px 24px 20px;width:450px;max-width:94vw;
  box-shadow:0 24px 60px rgba(0,0,0,.3);border-top:4px solid var(--brand);}
.modal-card h3{margin:0 0 16px;color:var(--charcoal);font-size:18px;}
.fld{display:flex;flex-direction:column;gap:6px;margin-bottom:14px;}
.fld-label{font-size:12.5px;font-weight:700;color:var(--charcoal);}
.fld-label .muted{font-weight:400;color:#bda99b;font-size:11.5px;}
.fld input,.fld select{padding:9px 11px;border:1.5px solid #e6d3c3;border-radius:9px;font-size:14px;color:var(--ink);
  font-weight:500;outline:none;background:#fff;width:100%;}
.fld input:focus,.fld select:focus{border-color:var(--brand);box-shadow:0 0 0 3px rgba(242,101,34,.15);}
.fld-row{display:flex;gap:14px;}
.fld-row .fld{flex:1;}
.modal-err{color:#d0392b;font-size:13px;min-height:18px;margin:0 0 8px;}
.modal-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:6px;}
.modal-sub{font-size:12.5px;color:var(--muted);margin:-8px 0 14px;line-height:1.4;}

/* connections modal */
.links-list{margin-bottom:16px;}
.link-row{display:flex;align-items:center;gap:8px;padding:8px 10px;border:1px solid #efe0d2;border-radius:9px;
  margin-bottom:7px;font-size:13px;}
.link-row .lk-from{font-weight:700;color:var(--charcoal);}
.link-row .lk-arrow{color:var(--brand);font-weight:700;}
.link-row .lk-to{font-weight:700;color:var(--charcoal);}
.link-row .lk-style{font-size:11px;color:var(--muted);background:#f3ece5;border-radius:20px;padding:1px 8px;}
.link-row .lk-spacer{flex:1;}
.links-empty{font-size:13px;color:var(--muted);padding:10px;text-align:center;border:1.5px dashed #f0cdb2;border-radius:10px;}
.links-add{border-top:1px dashed #ecdccd;padding-top:14px;}
.links-add-title{font-size:13px;font-weight:700;color:var(--charcoal);margin-bottom:10px;}

/* connections inside the Edit-position modal */
.edit-links{border-top:1px dashed #ecdccd;padding-top:12px;margin-bottom:13px;}
.edit-links > .fld-label{display:block;margin-bottom:8px;}
.edit-links-list{display:flex;flex-direction:column;gap:6px;margin-bottom:10px;}
.el-row{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12.5px;
  background:#fff7f1;border:1px solid #f1e0d2;border-radius:8px;padding:6px 10px;color:var(--charcoal);}
.el-row i{color:var(--muted);font-style:normal;font-size:11px;}
.el-empty{font-size:12px;color:var(--muted);padding:4px 2px;}
.edit-links-add{display:flex;gap:8px;align-items:center;}
.el-sel{flex:1;min-width:0;padding:8px 10px;border:1.5px solid #e6d3c3;border-radius:9px;font-size:13px;background:#fff;color:var(--ink);}
.el-sel:focus{border-color:var(--brand);outline:none;}
.edit-links-add .btn{white-space:nowrap;}

/* ---------- Dashboard & Tabs ---------- */
.admin-tabs {
  display: flex;
  margin: 14px 24px 0;
  border-bottom: 2px solid #e6dccd;
  gap: 8px;
  flex-shrink: 0;
}
.admin-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: -2px;
}
.admin-tab-btn:hover {
  color: var(--brand);
}
.admin-tab-btn.active {
  color: var(--brand-dark);
  border-bottom-color: var(--brand);
}

.dashboard-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* KPI Grid */
.dash-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.dash-kpi {
  background: #fff;
  border: 1px solid #efe0d2;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 4px 10px rgba(58,61,66,.04);
}
.dash-kpi-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--charcoal);
  line-height: 1;
}
.dash-kpi-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  margin-top: 6px;
  letter-spacing: 0.5px;
}

/* Sections */
.dash-sec {
  background: #fff;
  border: 1px solid #efe0d2;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 10px rgba(58,61,66,.04);
}
.dash-sec-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--charcoal);
  margin-top: 0;
  margin-bottom: 16px;
  border-bottom: 1.5px dashed #efe0d2;
  padding-bottom: 8px;
}

/* Table */
.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.dash-table th, .dash-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #f6ebe0;
}
.dash-table th {
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.5px;
}
.dash-table tbody tr:hover {
  background: var(--brand-soft);
}

/* Department breakdown row link */
.dash-lnk {
  color: var(--brand-dark);
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}
.dash-lnk:hover {
  text-decoration: underline;
}

/* Progress bar inside table or list */
.dash-progress-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dash-progress-bg {
  flex: 1;
  height: 8px;
  background: #f1f5f9;
  border-radius: 4px;
  overflow: hidden;
}
.dash-progress-fill {
  height: 100%;
  border-radius: 4px;
}

/* Status dots */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

/* ---------- Dashboard improvements ---------- */
.dash-layout {
  display: grid;
  grid-template-columns: 2.2fr 1fr;
  gap: 24px;
  align-items: start;
}
.dash-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
}
.dash-search-input {
  padding: 8px 12px;
  border: 1.5px solid #e6d3c3;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  background: #fff;
  width: 240px;
  transition: all 0.2s ease;
}
.dash-search-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(242, 101, 34, 0.12);
}

/* Open vacancies list style */
.vacancy-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}
.vacancy-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #fafafa;
  border: 1px solid #efe0d2;
  border-radius: 8px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.vacancy-item:hover {
  background: var(--brand-soft);
  border-color: var(--brand);
  transform: translateX(4px);
}
.vac-role-title {
  font-weight: 700;
  color: var(--charcoal);
}
.vac-dept-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
}

/* Styled KPI cards */
.dash-kpi {
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
  border-left: 4px solid var(--brand);
}
.dash-kpi:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(242, 101, 34, 0.12);
}
.dash-kpi.kpi-depts { border-left-color: #6366f1; }
.dash-kpi.kpi-seats { border-left-color: #3b82f6; }
.dash-kpi.kpi-active { border-left-color: #10b981; }
.dash-kpi.kpi-vacant { border-left-color: #ef4444; }
.dash-kpi.kpi-new { border-left-color: #f59e0b; }

/* Grid columns helper */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}


